Symfony: impossible to remove from cache
Ok, so this is my issue. I have a page that lists a bunch of categories under a subdomain. I'm trying to clean the cache for that page if the user is logged in. In the action I'm using this:
if ($this->getUser()->isAuthenticated())
{
if($cache = $this->getContext()->getViewCacheManager())
{
$cache->remove('category/index?subdomain='.$this->city->getLabel());
}
}
However, it doesn't matter how much I try, it won't remove it (the file remains untouched in 开发者_JAVA技巧the cache folder).
My cache.yml file shows the following:
index:
enabled: true
lifetime: 604800
What am I doing wrong?
Ah, nevermind. I was using it on the same action I was trying to remove (in the executeIndex function) which didn't make any sense because being cached as it was, the action wouldn't ever be loaded (at least not until the cached had expired).
精彩评论