kba-team/cakephp-predis

CakePHP 的 Predis 缓存引擎

安装数11,379

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:cakephp-plugin

v3.0.0 2024-08-22 07:35 UTC

This package is auto-updated.

Last update: 2024-09-22 07:53:43 UTC


README

License: MIT Packagist Version

CakePHP 2.x 的 Predis 插件

用法

composer require kba-team/cakephp-predis

在 bootstrap.php 中加载插件 ...

CakePlugin::load("PredisCache");

在你的配置文件 ...

Cache::config('_session_', [
    'engine' => 'PredisCache.Predis',
    'sentinel' => ['<sentinel host 1>', ...., '<sentinel host n>'],
    'password' => "<password>",
    'port' => 26379,
    'exceptions' => true,
    'database' => 1,
    'prefix' => "",
    'duration' => '+2 days', 
]);

可能的配置参数包括

  • engine Predis
  • scheme 目前仅支持 TCP
  • prefix 参考 CakePhp 2.x 缓存
  • server Redis 服务器(必须是主服务器)
  • sentinel 监视器节点列表(主机名或 IP 地址)
  • port 如果使用 server,则使用 Redis 端口(6379),否则使用监视器端口(26379)
  • exceptions 是否抛出异常(true)
  • database 参考 CakePhp 2.x 缓存 => 0
  • password Redis 密码
  • service 仅监视器:监视器服务名称(mymaster)

进一步阅读