【问题标题】:How to cache Cake generated XML files?如何缓存 Cake 生成的 XML 文件?
【发布时间】:2010-09-30 03:26:44
【问题描述】:

这是专门针对 CakePHP 的缓存系统的。

它似乎可以很好地缓存视图文件,但不适用于 xml 文件。 这是我要缓存的文件:/views/thing/xml/config.ctp

它是这样调用的:http://website.com/thing/config.xml

这是我的课程:

class ThingController extends AppController{ 
     public $helpers = array('Cache'); 
     public $cacheAction = array('config' => 36000); 
     function config(){ 
          // code here 
     } 
} 

我已经尝试过,阅读了食谱并在谷歌上搜索过,但没有结果。

谁能告诉我如何缓存一个由 CakePHP 生成的 XML 文件?

:)

【问题讨论】:

    标签: xml cakephp caching


    【解决方案1】:

    刚刚检查了您的代码,它完全符合我的要求。请检查 config/core.php 中的 Cache.disable 或 Cache.check 键。此外,请仔细检查网络服务器是否对 app/tmp/cache 具有写入权限。如果缓存工作正常,那么在您第一次请求 /thing/config 和 /thing/config.xml 之后应该有两个文件:thing_config.php 和 thing_config_xml.php。

    我记得 1.2 中的缓存机制存在一个缺陷,导致缓存视图无法使用与预期相同的 mimetype。 http://www.mail-archive.com/cake-php@googlegroups.com/msg59379.html

    还有一个指向食谱来源的链接,显示了他们是如何在那里解决的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-26
      • 2011-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-04
      • 2012-03-31
      • 2016-03-05
      相关资源
      最近更新 更多