public method

Constructor. Instantiates the Memcached object, adds appropriate servers to the pool, and configures any optional settings passed (see the _init() method).


  • 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|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): ['', ''] ['' => 200, '']




	public function __construct(array $config = []) {
		$defaults = [
			'scope' => null,
			'expiry' => '+1 hour',
			'host' => static::DEFAULT_HOST . ':' . static::DEFAULT_PORT
		parent::__construct(Set::merge($defaults, $config));