public method

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:

  • '' Configure the adapter to connect to one Memcache server on the default port.

  • '' Configure the adapter to connect to one Memcache server on a custom port.

  • array('' => 200, '') 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.


  • 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.




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