views:

40

answers:

1

Hello, I have the following in my controller:

var $cacheAction = array(
            'view/' => 432000,
            'pricelist/'=>'100000',
            'latest/' => '100000');

That is to cache the views for 5 days. I also enabled cache in core.php and included the cache helper in my controller.

The cache files are created correctly in tmp/cache/views/ but they don't seem to last for 5 days. If I do a file listing all files have been created in the last 3-4 minutes.

What am I doing wrong? Do I need another syntax for cache action?

thanks

+2  A: 

Are your actions using Models which change requently? From the Cookbook

It is important to remember that the Cake will clear a cached view if a model used in the cached view is modified. For example, if a cached view uses data from the Post model, and there has been an INSERT, UPDATE, or DELETE query made to a Post, the cache for that view is cleared, and new content is generated on the next request.

Jack B Nimble
No the model of this page isn't updated. BUT!The page shows pictures which a logged on user can add to his/her basket. BasketImages which is another model does get updated.Besides this view contains a div which reads SESSION variables and states how many images the user has in his basket.Can this be the reason?
gong
So I have tested that whenever you add an image to your basket, cache get cleared.Is there a way to prevent this?
gong
You might be able to do something where you use ajax on the portion that is dynamic, so that basket is coming from a view different from the one you are trying cache.
Jack B Nimble