zend-frameworkcachingzend-cache

Stop zend page cache in the Action


Here is a problem...

This is in my bootstrap:

$cache = Zend_Cache::factory('Page','File',$frontendOptions,$backendOptions);
$cache->start();
Zend_Registry::set("cache", $cache);

I need to cancel this $cache->start() from my action. I've tried Zend_Registry::get('cache')->cancel() but it doesn't work (actually, it's expected, because caching starts long before action processing).

How can I stop caching from action?

To understand why I need it: in my action, I have a function call from my model, and if it return void, I make redirect, so this page shouldn't be cached.


Solution

  • According to the ZF manual (The Specific Cancel Method) this is quite possible.

    Because of design issues, in some cases (for example when using non HTTP 200 return codes),   
    you could need to cancel the current cache process. So we introduce for this particular    
    frontend, the cancel() method.
    

    And the code seems correct except for the typo cacnel() instead of cancel()