devgeniem/wp-redis-object-cache-dropin
Composer 安装命令:
composer require devgeniem/wp-redis-object-cache-dropin
包简介
A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, HHVM, replication and clustering.
README 文档
README
A persistent object cache backend powered by Redis. Supports Predis, PhpRedis (PECL), HHVM, replication, clustering and WP-CLI.
Forked from Eric Mann's and Erick Hitter's Redis Object Cache.
And forked again from Till Krüss's Redis Cache.
We wanted to have only the object-cache.php dropin file and nothing else.
Installation
$ composer require devgeniem/wp-redis-object-cache-dropin
Connection Parameters
By default the object cache drop-in will connect to Redis over TCP at 127.0.0.1:6379 and select database 0.
To adjust the connection parameters, define any of the following constants in your wp-config.php file.
-
WP_REDIS_CLIENT(default: not set)Specifies the client used to communicate with Redis. Supports
hhvm,peclandpredis. -
WP_REDIS_SCHEME(default:tcp)Specifies the protocol used to communicate with an instance of Redis. Internally the client uses the connection class associated to the specified connection scheme. Supports
tcp(TCP/IP),unix(UNIX domain sockets),tls(transport layer security) orhttp(HTTP protocol through Webdis). -
WP_REDIS_HOST(default:127.0.0.1)IP or hostname of the target server. This is ignored when connecting to Redis using UNIX domain sockets.
-
WP_REDIS_PORT(default:6379)TCP/IP port of the target server. This is ignored when connecting to Redis using UNIX domain sockets.
-
WP_REDIS_PATH(default: not set)Path of the UNIX domain socket file used when connecting to Redis using UNIX domain sockets.
-
WP_REDIS_DATABASE(default:0)Accepts a numeric value that is used to automatically select a logical database with the
SELECTcommand. -
WP_REDIS_PASSWORD(default: not set)Accepts a value used to authenticate with a Redis server protected by password with the
AUTHcommand.
Configuration Parameters
To adjust the configuration, define any of the following constants in your wp-config.php file.
-
WP_CACHE_KEY_SALT(default: not set)Set the prefix for all cache keys. Useful in setups where multiple installs share a common
wp-config.phpor$table_prefix, to guarantee uniqueness of cache keys. -
WP_REDIS_MAXTTL(default: not set)Set maximum time-to-live (in seconds) for cache keys with an expiration time of
0. -
WP_REDIS_GLOBAL_GROUPS(default:['blog-details', 'blog-id-cache', 'blog-lookup', 'global-posts', 'networks', 'rss', 'sites', 'site-details', 'site-lookup', 'site-options', 'site-transient', 'users', 'useremail', 'userlogins', 'usermeta', 'user_meta', 'userslugs'])Set the list of network-wide cache groups that should not be prefixed with the blog-id (Multisite only).
-
WP_REDIS_IGNORED_GROUPS(default:['counts', 'plugins'])Set the cache groups that should not be cached in Redis.
Replication & Clustering
To use Replication and Clustering, make sure your server is running PHP7, your setup is using Predis to connect to Redis and you consulted the Predis documentation.
For replication use the WP_REDIS_SERVERS constant and for clustering the WP_REDIS_CLUSTER constant. You can use a named array or an URI string to specify the parameters.
For authentication use the WP_REDIS_PASSWORD constant.
Master-Slave Replication
define( 'WP_REDIS_SERVERS', [ 'tcp://127.0.0.1:6379?database=15&alias=master', 'tcp://127.0.0.2:6379?database=15&alias=slave-01', ] );
Clustering via Client-side Sharding
define( 'WP_REDIS_CLUSTER', [ 'tcp://127.0.0.1:6379?database=15&alias=node-01', 'tcp://127.0.0.2:6379?database=15&alias=node-02', ] );
Maintainers
devgeniem/wp-redis-object-cache-dropin 适用场景与选型建议
devgeniem/wp-redis-object-cache-dropin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.42k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2016 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 devgeniem/wp-redis-object-cache-dropin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devgeniem/wp-redis-object-cache-dropin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-10-30