rhubarbgroup / redis-cache
A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
Fund package maintenance!
tillkruss
www.paypal.me/tillkruss
Installs: 74 149
Dependents: 1
Suggesters: 0
Security: 0
Stars: 442
Watchers: 24
Forks: 150
Open Issues: 7
Type:wordpress-plugin
Requires
- php: ^7.2 || ^8.0
- colinmollenhour/credis: ^1.12.1
- composer/installers: ~1.0 || ~2.0
- mnsami/composer-custom-directory-installer: ^2.0
- predis/predis: ^1.1 || ^2.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.0
- dms/phpunit-arraysubset-asserts: ^0.4.0
- php-stubs/wp-cli-stubs: ^2.7
- phpcompatibility/phpcompatibility-wp: ^2.1
- phpunit/phpunit: ^7.0 || ^8.0 || ^9.0
- squizlabs/php_codesniffer: ^3.7
- szepeviktor/phpstan-wordpress: ^1.1
- wp-coding-standards/wpcs: ^2.3
- yoast/wp-test-utils: ^1.0
Suggests
- ext-redis: Required to use PhpRedis as the object cache backend.
- ext-relay: Required to use Relay as the object cache backend.
- dev-develop
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.26
- 2.0.25
- 2.0.24
- 2.0.23
- 2.0.22
- 2.0.21
- 2.0.20
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-RC1
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- dev-feature/plugin-check
- dev-main
- dev-change-serialization-logic
This package is auto-updated.
Last update: 2024-11-15 17:56:57 UTC
README
A persistent object cache backend powered by Redis®¹. Supports Predis, PhpRedis (PECL), Relay, replication, sentinels, clustering and WP-CLI.
Object Cache Pro
A business class Redis®¹ object cache backend. Truly reliable, highly optimized, fully customizable and with a dedicated engineer when you most need it.
- Rewritten for raw performance
- 100% WordPress API compliant
- Faster serialization and compression
- Easy debugging & logging
- Cache prefetching and advanced analytics
- Fully unit tested (100% code coverage)
- Optimized for WooCommerce, Jetpack & Yoast SEO
- And much more...
Installation
To get started, please see the installation instructions.
FAQ & Troubleshooting
Answers to common questions and troubleshooting of common errors can be found in the FAQ.
Configuration
The Redis Object Cache plugin comes with vast set of configuration options. If you're unsure how to use them read the installation instructions.
Advanced configuration options
Unsupported configuration options
Options that exist, but should not, may break without notice in future releases and won't receive any support whatsoever from our team:
Connections
Connecting over Unix socket
define( 'WP_REDIS_SCHEME', 'unix' ); define( 'WP_REDIS_PATH', '/var/run/redis.sock' );
Connecting over TCP+TLS
define( 'WP_REDIS_SCHEME', 'tls' ); define( 'WP_REDIS_HOST', 'master.ncit.ameaqx.use1.cache.amazonaws.com' ); define( 'WP_REDIS_PORT', 6379 );
Additional TLS/SSL stream connection options for connections can be defined using WP_REDIS_SSL_CONTEXT
:
define( 'WP_REDIS_SSL_CONTEXT', [ 'verify_peer' => false, 'verify_peer_name' => false, ]);
Connecting using ACL authentication
define( 'WP_REDIS_PASSWORD', [ 'username', 'password' ] );
Scaling
Redis Object Cache offers various replication, sharding, cluster and sentinel setups to users with advanced technical knowledge of Redis and PHP, that have consulted the Predis, PhpRedis or Relay documentation.
Relay
Relay is a next-generation cache that keeps a partial replica of Redis' dataset in PHP's memory for ridiculously fast lookups, especially when Redis Server is not on the same machine as WordPress.
define( 'WP_REDIS_CLIENT', 'relay' ); define( 'WP_REDIS_HOST', '127.0.0.1' ); define( 'WP_REDIS_PORT', 6379 ); // when using Relay, each WordPress installation // MUST a dedicated Redis database and unique prefix define( 'WP_REDIS_DATABASE', 0 ); define( 'WP_REDIS_PREFIX', 'db3:' ); // consume less memory define( 'WP_REDIS_IGBINARY', true );
Replication
https://redis.io/docs/management/replication/
define( 'WP_REDIS_CLIENT', 'predis' ); define( 'WP_REDIS_SERVERS', [ 'tcp://127.0.0.1:6379?database=5&role=master', 'tcp://127.0.0.2:6379?database=5&alias=replica-01', ] );
Sharding
This is a PhpRedis specific feature using RedisArray
.
define( 'WP_REDIS_CLIENT', 'phpredis' ); define( 'WP_REDIS_SHARDS', [ 'tcp://127.0.0.1:6379?database=10&alias=shard-01', 'tcp://127.0.0.2:6379?database=10&alias=shard-02', 'tcp://127.0.0.3:6379?database=10&alias=shard-03', ] );
Redis Sentinel
https://redis.io/docs/management/sentinel/
define( 'WP_REDIS_CLIENT', 'predis' ); define( 'WP_REDIS_SENTINEL', 'my-sentinel' ); define( 'WP_REDIS_SERVERS', [ 'tcp://127.0.0.1:5380', 'tcp://127.0.0.2:5381', 'tcp://127.0.0.3:5382', ] );
Redis Cluster
https://redis.io/docs/management/scaling/
define( 'WP_REDIS_CLIENT', 'phpredis' ); define( 'WP_REDIS_CLUSTER', [ 'tcp://127.0.0.1:6379?alias=node-01', 'tcp://127.0.0.2:6379?alias=node-02', 'tcp://127.0.0.3:6379?alias=node-03', ] );
WP CLI commands
Redis Object Cache has various WP CLI commands, for more information run wp help redis
.
Actions & Filters
Redis Object Cache has various hooks and the commonly used ones are listed below.
Footnotes
¹ Redis is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. Any use by Redis Object Cache is for referential purposes only and does not indicate any sponsorship, endorsement or affiliation between Redis and Redis Object Cache.