traackr / cache-engines
此包的最新版本(0.3.6)没有可用的许可信息。
CakePHP 缓存引擎
0.3.6
2021-01-27 20:16 UTC
Requires
- php: >=5.3
- composer/installers: ~1.0
- predis/predis: v0.8.5
Requires (Dev)
- cakephp/cakephp: 2.10.22
- m6web/redis-mock: v2.8.*
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2024-09-28 03:58:34 UTC
README
此 CakePHP 插件提供了一些 CakePHP 可以使用的附加缓存引擎。
我们目前提供以下三个缓存引擎
- RedisTreeCacheEngine:基于 Redis 的缓存,支持使用通配符管理键以及缓存键 'parents'。
- FileTreeCacheEngine:基于本地文件系统的缓存,支持使用通配符管理键以及缓存键 'parents'。
- FallBackCacheEngine:允许您定义两个缓存引擎;第一个引擎用作主缓存引擎。如果主引擎失败,则使用第二个缓存引擎。
##安装
$ cd /path/to/cake/application/app
$ composer require traackr/cache-engines
$ composer update
##配置引擎
要配置和使用这些缓存引擎,只需在相应的配置文件中指定缓存引擎名称(这通常是 app/Config/bootstrap.php
,参看 CakePHP 缓存配置文档)。RedisTreeeEngine
和 FileTreeEngine
使用与 CakePHP 一起提供的 RedisEngine
和 FileEngine
相同的参数。
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 文件夹中找到。
##贡献