Re: Caching dynamic url view
Why not just create a simplified route for that URL? Something like:
'/badge',
array('controlller' => 'posts', 'action' => 'your_action', 'id' => 23,
'size' => '180x150')
On Fri, Oct 2, 2009 at 10:58 PM, thinline <thinlinedev@gmail.com> wrote:
>
>
> I am trying to implement full view caching for a specific method in a
> controller.
>
> First I realized that if you set $this->layout = false; then caching
> will NOT happen. I have no idea why this occurs. I am not sure if this
> is a bug as I had a hard time debugging out how the cache works.
>
> Once, I turned that off I was able to get my view to cache by adding
> var $cacheAction = "1 hour";
>
> Since I don't want to cache everything in the view I need to cache
> just specific methods. The URL that I would like to cache looks like
> this:
> /posts/badge/23/size:180x150
> where 23 is the post ID and size is a named parameter (there are 2
> variations of size).
>
> So my question is what is the proper (if any) match to place in
> cacheAction to cache all posts/badges/* Here are some examples that I
> have tried:
>
> var $cacheAction = array(
> 'badge/*' => '+1 hour',
> 'posts/badge/23/size:180x150' => '1 hour',
> 'badge/23/size:180x150' => '1 hour',
> 'posts/badge/:id/:size' => '1 hour',
> 'badge/:id/:size' => '1 hour',
> );
>
> None of these seem to match (or at least do not cache for some
> reason). I do need to cache posts/badge/*/size:* and trap each of the
> parameters being passed.
>
> Again, if I set $cacheAction = "1 hour"; then the cache file is
> created (the file tmp/cache/views/posts_badge_23_size_180x150.php is
> created)
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home