【问题标题】:Extend RedisEngine in CakePHP在 CakePHP 中扩展 RedisEngine
【发布时间】:2018-12-28 16:56:15
【问题描述】:

我在 Cake 的 RedisEngine 文件中创建了一些自定义方法来执行 Redis spop...等操作。我知道在 Cake Lib 中编辑实际的 RedisEngine 文件本身并不理想,但我不确定如何扩展它以便我可以添加自己的方法。或者更具体地说,如果我扩展它,我如何告诉 Cake 使用 MyRedisEngine 而不是默认的?

【问题讨论】:

标签: cakephp cakephp-2.x


【解决方案1】:

根据this page in the CakePHP Book,您可以通过在Config/bootstrap.php 中指定这样的配置来扩展CacheEngine

Cache::config('custom', array(
    'engine' => 'MyCustomCacheEngine', // if this doesn't work, try without the 'Engine'
    // ...
));

并在app/Lib/Cache/Engine/ 目录中添加MyCustomCacheEngine.php 文件。

【讨论】:

  • (感谢您指出我错过的书中的位置,@ndm)
猜你喜欢
  • 1970-01-01
  • 2018-01-17
  • 2012-07-29
  • 1970-01-01
  • 2014-05-06
  • 2011-09-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多