【问题标题】:Stop zend page cache in the Action在 Action 中停止 zend 页面缓存
【发布时间】:2013-08-12 21:08:53
【问题描述】:

这里有个问题……

这是在我的引导程序中:

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

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

如何停止缓存操作?

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

【问题讨论】:

    标签: zend-framework caching zend-cache


    【解决方案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() 之外,代码似乎是正确的

    【讨论】:

      猜你喜欢
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-04
      相关资源
      最近更新 更多