1
我最近偶然發現了一個問題。我有幾個部分這是在幾個動作,並有顯示數據的方式不同,所以我用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