lithium\storage\cache\adapter\Memcache::__construct()
Constructor. Instantiates the Memcached
object, adds appropriate servers to the pool,
and configures any optional settings passed (see the _init()
method).
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|array: 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. Use the array format for multiple hosts (optionally with server selection weights):array('167.221.1.5:11222', '167.221.1.6')
array('167.221.1.5:11222' => 200, '167.221.1.6')
Returns
voidSource
public function __construct(array $config = []) {
$defaults = [
'scope' => null,
'expiry' => '+1 hour',
'host' => static::DEFAULT_HOST . ':' . static::DEFAULT_PORT
];
parent::__construct(Set::merge($defaults, $config));
}