[英]Removing the cache of a contextual partial in Symfony 1.4
我最近偶然發現了一個問題。 我有幾個部分,它們在幾個動作中有不同的顯示數據的方式,因此我在cache.yml中使用了上下文選項,例如:
_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 :: remove的第四個選項,即上下文:
$context = 'space/show/sf_culture/fr/slug/'.$slug.'/tab/news/comment/_list/'.$id;
$cache_manager->remove($uri, '', '', $context); // return null
有人知道怎么做嗎 ? 我越來越絕望了:P
謝謝。
好吧,看來sfFileCache中有錯誤。 我向symfony bugtracker提交了補丁。
作為參考,您可以在此處查看票證和補丁。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.