简体   繁体   中英

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM