开发者

Symfony: impossible to remove from cache

开发者 https://www.devze.com 2023-01-22 09:24 出处:网络
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.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消