ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v6:caching:rediscluster

The Redis Cluster Caching Plugin

Description

This plugin enables caching using a previously configured REDIS cluster. This version cannot be used to connect to individual servers. For that, use the The Redis Caching Plugin version instead.

This system does not support features like AUTH and client side configurations, only the cluster password can be used.

'' ADOdb\addins\cache\plugins\rediscluster\ADOCacheDefinitions ''

Prerequisites

The Redis PECL Package. The ADOdb extension works in conjunction with the package, as installed and configured here.

The ADOCachingDefinitions Class

class ADOCacheDefinitions
{
     /*
    * Debugging for cache
    */
    public bool $debug = true;
 
    /*
    * Service flag. Do not modify value
    */
    public string $serviceName = 'rediscluster';
 
    /*
    * Service Name.
    */
    public string $serviceDescription = 'REDISCLUSTER';
 
    /*
    * The connection configuration
    * The cluster hosts format is array('host:port','host:port',.....)
    */
    public array   $redisHosts     = array();
    public ?string $persistentId  = null;
    public int     $retryInterval = 0;
    public int     $readTimeout   = 0;
 
    /*
    * Sets the initial redis database
    */
    public int $redisDatabase = 0;
 
    /*
    * Client options as available
    */
    public array $redisClientOptions = array();
 
 
    /*
    * Are we adding a persistent connection 
    */
    public bool $redisPersistent = false;
 
    /*
    * Allow asynchronous deletion actions
    */
    public bool $redisAsynchronous = false;
 
    /*
    * If used, must contain a string with the password
    */
    public ?string $redisPassword = null;
 
 
}

redisHosts

This mandatory item must contain an array of the hosts/ports that define the cluster connections to which you are establishing a connection.

$adc = new \ADOdb\addins\cache\plugins\recidcluster\ADOCacheDefinitions;
 
$adc->redisHosts = array(
    '192.168.86.91:7000',
    '192.168.86.91:7001',
    '192.168.86.91:7002',
    '192.168.86.91:7003',
    '192.168.86.91:7004',
    );

retry Interval

To override the default retry time (in Milliseconds) set the value here.

readTimeout

Th default timeout value for reading is 0, which creates a blocking interface to Redis server.

redisDatabase

if a non-default database is required, set the value here 0-9

redisClientOptions

A key⇒value pair array to set client type options

$redis = new ADOdb\addins\cache\plugins\rediscluster\ADOCacheDefinitions;
$redis->redisClientOptions = array(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);

redisPersistent

A Boolean value telling the code to etablish a persistent connection to the database using the ID provided above.

redisAsynchronous

This is a boolean value (default false). If set to true, then the REDIS server will allow Asynchronous Deletion of records. Use with care because the ADOdb connection has no real way of dealing with the consequences of this.

redisPassword

If used, the $redisAuth value must be a string that represents the cluster password.

v6/caching/rediscluster.txt · Last modified: by 127.0.0.1