views:

62

answers:

1

I've stumbled recently upon a problem. I have several partial which are in several actions and have different way of displaying data, hence I used the contextual option in cache.yml as such :

_list:
  enabled: true
  contextual: true

Now I needed to remove the partial cache when the data was updated, which is normally pretty easy when dealing with non-contextual partial cache or action cache.

However when I try to remove this cache, I only get null return values, and the cache is not removed. Like this :

$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

I tried to fiddle with the fourth option of sfViewCacheManager::remove, which is the context, as such :

$context = 'space/show/sf_culture/fr/slug/'.$slug.'/tab/news/comment/_list/'.$id;
$cache_manager->remove($uri, '', '', $context); // return null

Anyone know how to do this ? I'm getting desperate :P

Thanks.

A: 

Well it seems there was a bug in sfFileCache. I submitted a patch to the symfony bugtracker.

For reference you can see the ticket and the patch here.

DuoSRX