if (\Memcached::SERIALIZER_PHP !==
$opt && \Memcached::SERIALIZER_IGBINARY !==
$opt) { throw new CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'
);
} $this->maxIdLength -= \
strlen($client->
getOption(\Memcached::OPT_PREFIX_KEY
));
$this->client =
$client;
} else { $this->lazyClient =
$client;
} parent::
__construct($namespace,
$defaultLifetime);
$this->
enableVersioning();
$this->marshaller =
$marshaller ??
new DefaultMarshaller();
} /**
* @return bool
*/
public static function isSupported() { return \
extension_loaded('memcached'
) &&
version_compare(phpversion('memcached'
), '3.1.6', '>='
);
} /**
* Creates a Memcached instance.
*
* By default, the binary protocol, no block, and libketama compatible options are enabled.
*
* Examples for servers:
* - 'memcached://user:pass@localhost?weight=33'
* - [['localhost', 11211, 33]]
*
* @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs
*
* @throws \ErrorException When invalid options or servers are provided
*/