traackr/cache-engines

此包的最新版本(0.3.6)没有可用的许可信息。

CakePHP 缓存引擎

安装次数: 49,803

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 18

分支: 0

公开问题: 0

类型:cakephp-plugin

0.3.6 2021-01-27 20:16 UTC

README

Build Status

此 CakePHP 插件提供了一些 CakePHP 可以使用的附加缓存引擎。

我们目前提供以下三个缓存引擎

  1. RedisTreeCacheEngine:基于 Redis 的缓存,支持使用通配符管理键以及缓存键 'parents'。
  2. FileTreeCacheEngine:基于本地文件系统的缓存,支持使用通配符管理键以及缓存键 'parents'。
  3. FallBackCacheEngine:允许您定义两个缓存引擎;第一个引擎用作主缓存引擎。如果主引擎失败,则使用第二个缓存引擎。

##安装

$ cd /path/to/cake/application/app
$ composer require traackr/cache-engines
$ composer update

##配置引擎

要配置和使用这些缓存引擎,只需在相应的配置文件中指定缓存引擎名称(这通常是 app/Config/bootstrap.php,参看 CakePHP 缓存配置文档)。RedisTreeeEngineFileTreeEngine 使用与 CakePHP 一起提供的 RedisEngineFileEngine 相同的参数。

Cache::config("post_data", array(
   'engine' => 'RedisTree',
   'server' => 'redis-server',
   'port' => 6379,
   'duration' => 300,
   'prefix' => 'posts:'
));

FallbackEngine 预期主引擎和副引擎的配置

Cache::config("post_data", array(
   'engine' => 'Fallback',
   'name' => "post_data",
   'primary' => array(
      'profile' => '2.8', // optional, if you want to hardcode a predis profile to use
      'engine' => 'RedisTree',
      'server' => 'redis-server',
      'port' => 6379,
      'duration' => 300,
      'prefix' => 'posts:'
   ),
   'secondary' => array(
      // alternate cache if Redis fails
      'engine' => 'FileTree',
      'path' => CACHE.'/data/',
      'duration' => 300
   )
));

##文档

所有其他文档可以在 doc 文件夹中找到。

##贡献