我正在开发一个Symfony2项目。我想为我的类和方法添加一个缓存。试图通过像这样的注释实现这一点:
/**
* @Cache(expires="+5 minutes", public=true)
*/
class MyCacheClass
{
public function MyCacheMethod()
{
/...../
}
}
我包含这个库:
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
我遵循了Symfony2 Documentation page。但这似乎根本不起作用。我做错了吗?
HTTP Response Header:
Access-Control-Allow-Origin:*
Cache-Control:public
Connection:Keep-Alive
Content-Type:application/json
Date:Tue, 13 Jan 2015 11:59:53 GMT
Expires:Tue, 13 Jan 2015 12:04:54 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.4.10 (Unix) PHP/5.5.16 mod_wsgi/3.4 Python/2.7.6 OpenSSL/1.0.1h
Transfer-Encoding:chunked