views:

17

answers:

1

Hi,

This is specifically about CakePHP's caching system.

It seems to work fine caching view files, but not for xml files. This is the file I want to cache: /views/thing/xml/config.ctp

It is being called like this: http://website.com/thing/config.xml

This is the class I have:

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

I have tried, read the cookbook and googled for this but no result.

Anyone can tell me how do I cache an XML file that is generated by CakePHP?

:)

A: 

Just checked your code, and it's perfectly working on my end. Please check your Cache.disable or Cache.check keys in config/core.php. Also, double check if the webserver has write permission on app/tmp/cache. If the cache is working, there should be two files after the first time you have requested both /thing/config and /thing/config.xml: thing_config.php and thing_config_xml.php.

I remember there was a flaw in the Caching mechanism in 1.2, which caused cached views not to be served with the same mimetype as intended. http://www.mail-archive.com/[email protected]/msg59379.html

There's also a link to the cookbook source, which shows how they solved it there.

Bjorn