Search code examples
cakephpcachingcakephp-2.8

CakePHP: Cannot read from a custom cache in 2.8.4?


This is painfully simple, but I cannot determine why it simply will not work as the Cookbook suggests it will. I am getting a blank result when I run the following:

Cache::write('req_quals', $value, 'permacache');
Cache::read('req_quals', 'permacache');

The config looks like:

Cache::config('permacache', array('engine' => 'File', 'path' => CACHE . 'permacache' . DS, 'duration' => '+9999 days'));

  • The write works. I know this because I'm looking directly into the tmp/cache/permacache folder and I see the file with its contents inside.
  • I can write/read this value without any problem if I remove the 'permacache' from both lines.

Am I missing something obvious?


Solution

  • When Cake calculates duration, +9999 days returns a negative duration. You should avoid being a cool guy and just use +999 days as the documentation subtly suggests.