删除Symfony 1.4中上下文部分的缓存
问题描述:
我最近偶然发现了一个问题。我有几个部分这是在几个动作,并有显示数据的方式不同,所以我用cache.yml这样的上下文选项:删除Symfony 1.4中上下文部分的缓存
_list:
enabled: true
contextual: true
现在我需要删除部分缓存,当数据被更新在处理非上下文部分缓存或动作缓存时通常非常容易。
但是,当我尝试删除此缓存时,我只能得到空返回值,并且不会删除缓存。就像这样:
$uri = '@sf_cache_partial?module=comment&action=_list&sf_cache_key='.$id;
$cache_manager = $this->getContext()->getViewCacheManager();
$cache_manager->has($uri) // return true
$cache_manager->remove($uri) // return null
$cache_manager->has($uri) // return true, cache is still there
我试着用sfViewCacheManager的第四个选项::删除,这是上下文拨弄,因为这样的:
$context = 'space/show/sf_culture/fr/slug/'.$slug.'/tab/news/comment/_list/'.$id;
$cache_manager->remove($uri, '', '', $context); // return null
任何人都知道如何做到这一点?我越来越绝望:P
谢谢。
我不知道你的问题的答案,但我想你可能会通过一步一步的调试来找出remove()函数的错误,例如XDebug。祝你好运! – greg0ire 2010-06-10 21:49:22