Hello,

I've encountered, I think, the same kind of problem.

Here is how I managed to remove the contextual partial cache :
Frontend side, I got MyModule, with action 'show' in which I display a _partial. This is the one that is contextual, depending on show action parameters.
frontend/modules/MyModule/config/cache.yml :
_partial:
   contextual:   true
   enabled:      true

frontend/modules/MyModule/templates/showSuccess.php :
...
<?php include_component('MyModule', 'partial', array('some_data' => $some_data, 'sf_cache_key' => $myObject->getSlugName()))?>
...

I guess it will work with something else than getSlugName on object.

Ok, now Backend side, each time I do a modification on any myObject, in the actions, i call a protected function clearCache :
backend/modules/MyModule/actions/actions.class.php :
protected function clearCache($options = array())
{
$cacheManager = $this->getContext()->getViewCacheManager();

$cacheManager->remove('MyModule/edit?id=' . $options['object_id']; // for example...

// now what's interesting :
sfContext::switchTo('frontend');
$cacheManager = sfContext::getInstance()->getViewCacheManager();
$cacheManager->remove('@sf_cache_partial?module=MyModule&action=_partial&sf_cache_key=' . $options['object_slug_name'], '', '', 'MyModule/show/slug_name/' . $options['object_slug_name']);
sfContext::switchTo('backend');
}


And this way I update my partial on another app, and only the one I'm interested in.

Maybe the way I do it can be perfected... But it seems to work ok on my side.

Hope it can help.

Regards,
Simon

kirsis a écrit :
When removing a partial from the cache, using an internal cache id
(like mentioned on
http://www.symfony-project.org/book/1_2/12-Caching#chapter_12_sub_clearing_selective_parts_of_the_cache),
the operation fails if the partial is contextual.

I checked out the symfony cache dir, it seems symfony caches
contextual partials as actions (outside the partial cache directory
and in module/action folder). However, clearing the action cache
doesn't seem to work either.

Is this a bug? And in either way, is there any way to clear the
symfony cache for a contextual partial using the internal ID (i.e.
without manually deleting the files)?

Thanks,
- J


--
You received this message because you are subscribed to the Google Groups "symfony 
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to