lithium\storage\cache\adapter\Redis::__construct()
Constructor.
Parameters
-
array
$config
Configuration for this cache adapter. These settings are queryable through
Cache::config('name')
. The available options are as follows:'scope'
string: Scope which will prefix keys; per default not set.'expiry'
mixed: The default expiration time for cache values, if no value is otherwise set. Can be either astrtotime()
compatible tring or TTL in seconds. To indicate items should not expire useCache::PERSIST
. Defaults to+1 hour
.'host'
string: A string in the form of'<host>'
,'<host>:<port>'
or':<port>'
indicating the host and/or port to connect to. When one or both are not provided uses general server defaults. To use Unix sockets specify the path to the socket (i.e.'/path/to/socket'
).'persistent'
boolean: Indicates whether the adapter should use a persistent connection when attempting to connect to the Redis server. Iftrue
, it will attempt to reuse an existing connection when connecting, and the connection will not close when the request is terminated. Defaults tofalse
.
Returns
voidSource
public function __construct(array $config = []) {
$defaults = [
'scope' => null,
'expiry' => '+1 hour',
'host' => static::DEFAULT_HOST . ':' . static::DEFAULT_PORT,
'persistent' => false
];
parent::__construct($config + $defaults);
}