PHP code example of rhubarbgroup / redis-cache
1. Go to this page and download the library: Download rhubarbgroup/redis-cache library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rhubarbgroup / redis-cache example snippets
define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/var/run/redis.sock' );
define( 'WP_REDIS_SCHEME', 'tls' );
define( 'WP_REDIS_HOST', 'master.ncit.ameaqx.use1.cache.amazonaws.com' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_SSL_CONTEXT', [
'verify_peer' => false,
'verify_peer_name' => false,
]);
define( 'WP_REDIS_PASSWORD', [ 'username', 'password' ] );
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 );
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',
] );
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',
] );
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',
] );
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',
] );