What about when we are trying to remove something from the cache?
I am accessing an action /user/show/id/1; in theory, this falls under
the first example, i.e. cache is enabled (anyway, I _see_ that it is
enabled because data doesn't update when I update it). I want to add a
remove() call to the cache on update.
I tried the following as per the manual:
- in my showSuccess.php:
<? if (!cache("user".$user->getUserid(), 3600)): ?>
blah blah
<? cache_save(); endif; ?>
- in my actions.class.php, in the executeUpdate():
$cacheManager = $this->getContext()->getViewCacheManager();
$cacheManager->remove("@sf_cache_partial?
module=user&action=show&sf_cache_key=user".$this-
>getRequestParameter('id'));
This does not remove the cache (just for fun I tried removing the
$user->getUserid() and $this->getrequest...etc, i.e. leaving a single
cache entry for the whole world, but that *still* didn't remove the
cache).
I suspect this is related to the GET parameters, perhaps Symfony
assigns another key to this?
Any help appreciated!
On Sep 6, 7:38 am, "Francois Zaninotto" <[EMAIL PROTECTED]
project.com> wrote:
> You have to make the difference between the GET parameters that are
> (automatically) transformed by the symfony routing system, and those don't
> deactivate the cache, and the ones that are (manually) added as a query
> string, and then cache is deactivated.
>
> link_to('click me', 'foo/bar?key1=value1&key2=value3')
> => foo/bar/key1/value1/key2/value2
> => caching works
>
> link_to('click me', 'foo/bar?key1=value1', array('query_string' =>
> 'key2=value3'))
> => foo/bar/key1/value1?key2=value2
> => caching is deactivated
>
> Fran ois
>
> 2007/9/6, Jiang Le <[EMAIL PROTECTED]>:
>
>
>
> > Hi,
>
> > I'm reading chapter 12 of the book 'The Definitive Guide to symfony' .
> > And I am quite unsure about this caution in the chatper:
>
> > Actions called with a POST method or with GET parameters are not
> > cached
>
> > I know that POST method calls are not cached but why actions with GET
> > parameters are not cached? In the same chapter they've just mentioned
> > "Now, every call to the user/show action with a different id argument
> > creates a new record in the cache".
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---