Monday, May 17, 2010

Named cache config setting from views

Hi,

I've bumped into some unexpected behavior when pulling cache data
using a named cache config setting from within a view.

For example:-

In core.php I have something like this:-
$cache_method = 'Apc'
Cache::config('short',array('engine'=>
$cache_method,'duration'=>'300'));
Cache::config('medium',array('engine'=>
$cache_method,'duration'=>'900'));
Cache::config('long',array('engine'=>
$cache_method,'duration'=>'3600'));
Cache::config('default',array('engine'=>
$cache_method,'duration'=>'180'));

Which works great when I use those config names for Cache::read and
Cache::write within models and controllers.

Unfortunately when I use those Cache methods using config names within
a view I get a cache miss which when you are trying to wrap a
requestAction() is less than ideal -- I note that the object does get
written to the cache as I can see it (with APC info) but it seems
calling it back fails.

But here is the important twist -- if I use the Cache config name
'default' (our just leave it out) all works as expected.

Am I missing something special I need to do in order to cache data
within a view or is this an issue?

Ahh, and I additionally note that <app>/tmp/cache/views is becoming
populated with elements that I've called via $this-
>element('foobar',array('cache'=>array('key'=>'foobar','time'=>'+10
minutes'))) -- I was expecting to find those in the memory cache.

Cheers,
N

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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


Real Estate