FileAccess Orion

MemcachedAdapter extends AbstractAdapter
in package

Tags
author

Rob Frawley 2nd rmf@src.run

author

Nicolas Grekas p@tchwork.com

Table of Contents

$maxIdLength  : mixed
$apcuSupported  : mixed
$client  : mixed
$defaultClientOptions  : mixed
$lazyClient  : mixed
$marshaller  : mixed
$phpFilesSupported  : mixed
__construct()  : mixed
Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged.
commit()  : bool
{@inheritdoc}
createConnection()  : Memcached
Creates a Memcached instance.
createSystemCache()  : AdapterInterface
Returns the best possible adapter that your runtime supports.
isSupported()  : mixed
doClear()  : mixed
{@inheritdoc}
doDelete()  : mixed
{@inheritdoc}
doFetch()  : mixed
{@inheritdoc}
doHave()  : mixed
{@inheritdoc}
doSave()  : mixed
{@inheritdoc}
checkResultCode()  : mixed
getClient()  : Memcached

Properties

$defaultClientOptions

private static mixed $defaultClientOptions = ['persistent_id' => null, 'username' => null, 'password' => null, \Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_PHP]

Methods

__construct()

Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged.

public __construct(Memcached $client[, string $namespace = '' ], int $defaultLifetime[, MarshallerInterface $marshaller = null ]) : mixed

Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that:

  • the Memcached::OPT_BINARY_PROTOCOL must be enabled (that's the default when using MemcachedAdapter::createConnection());
  • tags eviction by Memcached's LRU algorithm will break by-tags invalidation; your Memcached memory should be large enough to never trigger LRU.

Using a MemcachedAdapter as a pure items store is fine.

Parameters
$client : Memcached
$namespace : string = ''
$defaultLifetime : int
$marshaller : MarshallerInterface = null
Return values
mixed

commit()

{@inheritdoc}

public commit() : bool
Return values
bool

createConnection()

Creates a Memcached instance.

public static createConnection(array<string|int, array<string|int, mixed>>|string|array<string|int, string> $servers[, array<string|int, mixed> $options = [] ]) : Memcached

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]]
Parameters
$servers : array<string|int, array<string|int, mixed>>|string|array<string|int, string>

An array of servers, a DSN, or an array of DSNs

$options : array<string|int, mixed> = []

An array of options

Tags
throws
ErrorException

When invalid options or servers are provided

Return values
Memcached

createSystemCache()

Returns the best possible adapter that your runtime supports.

public static createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory[, LoggerInterface $logger = null ]) : AdapterInterface

Using ApcuAdapter makes system caches compatible with read-only filesystems.

Parameters
$namespace : string
$defaultLifetime : int
$version : string
$directory : string
$logger : LoggerInterface = null
Return values
AdapterInterface

isSupported()

public static isSupported() : mixed
Return values
mixed

doClear()

{@inheritdoc}

protected doClear(string $namespace) : mixed
Parameters
$namespace : string
Return values
mixed

doDelete()

{@inheritdoc}

protected doDelete(array<string|int, mixed> $ids) : mixed
Parameters
$ids : array<string|int, mixed>
Return values
mixed

doFetch()

{@inheritdoc}

protected doFetch(array<string|int, mixed> $ids) : mixed
Parameters
$ids : array<string|int, mixed>
Return values
mixed

doHave()

{@inheritdoc}

protected doHave(string $id) : mixed
Parameters
$id : string
Return values
mixed

doSave()

{@inheritdoc}

protected doSave(array<string|int, mixed> $values, int $lifetime) : mixed
Parameters
$values : array<string|int, mixed>
$lifetime : int
Return values
mixed

checkResultCode()

private checkResultCode(mixed $result) : mixed
Parameters
$result : mixed
Return values
mixed

getClient()

private getClient() : Memcached
Return values
Memcached

Search results