在Action中停止zend页面缓存

时间:2013-08-12 21:08:54

标签: zend-framework caching zend-cache

这是一个问题......

这是在我的引导程序中:

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

我需要从我的操作中取消$cache->start()。我已经尝试Zend_Registry::get('cache')->cancel()但它不起作用(实际上,它是预期的,因为缓存在动作处理之前很久就会开始)。

如何停止缓存操作?

要理解我为什么需要它:在我的操作中,我有一个来自我的模型的函数调用,如果它返回void,我进行重定向,所以不应该缓存此页面。

1 个答案:

答案 0 :(得分:1)

根据ZF手册(The Specific Cancel Method),这很有可能。

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.

除了拼写错误cacnel()而不是cancel()

之外,代码似乎也是正确的
相关问题