【问题标题】:CakePHP: Cannot read from a custom cache in 2.8.4?CakePHP:无法从 2.8.4 中的自定义缓存中读取?
【发布时间】:2016-08-16 18:27:04
【问题描述】:

这非常简单,但我无法确定为什么它根本不会像 Cookbook 所暗示的那样工作。当我运行以下命令时,我得到一个空白结果:

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

配置如下:

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

  • 写入有效。我知道这一点,因为我直接查看 tmp/cache/permacache 文件夹,我看到了里面有内容的文件。
  • 如果我从两行中删除“永久缓存”,我可以毫无问题地写入/读取此值。

我是否遗漏了一些明显的东西?

【问题讨论】:

    标签: cakephp caching cakephp-2.8


    【解决方案1】:

    当 Cake 计算 duration 时,+9999 天返回负持续时间。你应该避免成为一个酷人,而只是使用+999 days 作为文档subtly suggests

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-23
      • 2017-05-20
      • 1970-01-01
      • 2021-03-15
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 2021-02-27
      相关资源
      最近更新 更多