/** * Constructor. Instantiates the `Memcached` object, adds appropriate servers to the pool, * and configures any optional settings passed (see the `_init()` method). When adding * servers, the following formats are valid for the `'host'` key: * * - `'127.0.0.1'` * Configure the adapter to connect to one Memcache server on the default port. * * - `'127.0.0.1:11222'` * Configure the adapter to connect to one Memcache server on a custom port. * * - `array('167.221.1.5:11222' => 200, '167.221.1.6')` * Connect to one server on a custom port with a high selection weight, and * a second server on the default port with the default selection weight. * * @see lithium\storage\Cache::config() * @param 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 a `strtotime()` compatible tring or TTL in * seconds. To indicate items should not expire use `Cache::PERSIST`. Defaults * to `+1 hour`. * - `'host'` _mixed_: Specifies one or more Memcache servers to connect to, with * optional server selection weights. See above for example values. * @return void */ public function __construct(array $config = array()) { $defaults = array('scope' => null, 'expiry' => '+1 hour', 'host' => '127.0.0.1'); parent::__construct(Set::merge($defaults, $config)); }
/** * Constructor. * * @see lithium\storage\Cache::config() * @param 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 a `strtotime()` compatible tring or TTL in * seconds. To indicate items should not expire use `Cache::PERSIST`. Defaults * to `+1 hour`. * - `'path'` _string_: Path where cached entries live, defaults to * `Libraries::get(true, 'resources') . '/tmp/cache'`. * @return void */ public function __construct(array $config = array()) { $defaults = array('path' => Libraries::get(true, 'resources') . '/tmp/cache', 'scope' => null, 'expiry' => '+1 hour'); parent::__construct($config + $defaults); }
/** * Constructor. * * @see lithium\storage\Cache::config() * @param 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 a `strtotime()` compatible tring or TTL in * seconds. To indicate items should not expire use `Cache::PERSIST`. Defaults * to `+1 hour`. * @return void */ public function __construct(array $config = array()) { $defaults = array('scope' => null, 'expiry' => '+1 hour'); parent::__construct($config + $defaults); }
/** * Constructor. * * @todo Implement configurable & optional authentication * @see lithium\storage\Cache::config() * @see lithium\storage\cache\adapter\Redis::write() * @param 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 a `strtotime()` compatible tring or TTL in * seconds. To indicate items should not expire use `Cache::PERSIST`. Defaults * to `+1 hour`. * - `'host'` _string_: A string in the form of `'host:port'` indicating the Redis server * to connect to. Defaults to `'127.0.0.1:6379'`. * - `'persistent'` _boolean_: Indicates whether the adapter should use a persistent * connection when attempting to connect to the Redis server. If `true`, it will * attempt to reuse an existing connection when connecting, and the connection will * not close when the request is terminated. Defaults to `false`. * @return void */ public function __construct(array $config = array()) { $defaults = array('host' => '127.0.0.1:6379', 'scope' => null, 'expiry' => '+1 hour', 'persistent' => false); parent::__construct($config + $defaults); }