MemcachedOptions
extends AdapterOptions
in package
These are options specific to the Memcached adapter
Table of Contents
- $__prioritizedProperties__ : array<string|int, string>
- Prioritized properties ordered by prio to be set first in case a bulk of options sets set at once
- $__strictMode__ : bool
- We use the __ prefix to avoid collisions with properties in user-implementations.
- $adapter : null|StorageInterface
- The adapter using these options
- $keyPattern : string
- Validate key against pattern
- $namespace : string
- Namespace option
- $namespaceSeparator : string
- The namespace separator
- $readable : bool
- Readable option
- $resourceId : string
- The resource id of the resource manager
- $resourceManager : null|MemcachedResourceManager
- The memcached resource manager
- $ttl : int|float
- TTL option
- $writable : bool
- Writable option
- __construct() : mixed
- Constructor
- __get() : mixed
- Get a configuration property
- __isset() : bool
- Test if a configuration property is null
- __set() : void
- Set a configuration property
- __unset() : void
- Set a configuration property to NULL
- addServer() : MemcachedOptions
- Add a server to the list
- getKeyPattern() : string
- Get key pattern
- getLibOption() : mixed
- Get libmemcached option
- getLibOptions() : array<string|int, mixed>
- Get libmemcached options
- getMemcachedResource() : Memcached
- Get memcached resource to share
- getNamespace() : string
- Get namespace
- getNamespaceSeparator() : string
- Get namespace separator
- getPersistentId() : string
- Get the persistent id
- getReadable() : bool
- If reading data from cache enabled.
- getResourceId() : string
- Get the memcached resource id
- getResourceManager() : MemcachedResourceManager
- Get the memcached resource manager
- getServers() : array<string|int, mixed>
- Get Servers
- getTtl() : float
- Get time to live.
- getWritable() : bool
- If writing data to cache enabled.
- setAdapter() : AdapterOptions
- Adapter using this instance
- setFromArray() : AbstractOptions
- Set one or more configuration properties
- setKeyPattern() : AdapterOptions
- Set key pattern
- setLibOption() : MemcachedOptions
- Set libmemcached option
- setLibOptions() : MemcachedOptions
- Set libmemcached options
- setMemcachedResource() : MemcachedOptions
- A memcached resource to share
- setNamespace() : AdapterOptions
- Set namespace.
- setNamespaceSeparator() : MemcachedOptions
- Set namespace separator
- setPersistentId() : MemcachedOptions
- Set the persistent id
- setReadable() : AdapterOptions
- Enable/Disable reading data from cache.
- setResourceId() : MemcachedOptions
- Set the memcached resource id
- setResourceManager() : MemcachedOptions
- Set the memcached resource manager to use
- setServers() : MemcachedOptions
- Set a list of memcached servers to add on initialize
- setTtl() : AdapterOptions
- Set time to live.
- setWritable() : AdapterOptions
- Enable/Disable writing data to cache.
- toArray() : array<string|int, mixed>
- Cast to array
- normalizeTtl() : void
- Validates and normalize a TTL.
- triggerOptionEvent() : void
- Triggers an option event if this options instance has a connection to an adapter implements EventsCapableInterface.
Properties
$__prioritizedProperties__
Prioritized properties ordered by prio to be set first in case a bulk of options sets set at once
protected
array<string|int, string>
$__prioritizedProperties__
= ['resource_manager', 'resource_id']
$__strictMode__
We use the __ prefix to avoid collisions with properties in user-implementations.
protected
bool
$__strictMode__
= true
$adapter
The adapter using these options
protected
null|StorageInterface
$adapter
$keyPattern
Validate key against pattern
protected
string
$keyPattern
= ''
$namespace
Namespace option
protected
string
$namespace
= 'zfcache'
$namespaceSeparator
The namespace separator
protected
string
$namespaceSeparator
= ':'
$readable
Readable option
protected
bool
$readable
= true
$resourceId
The resource id of the resource manager
protected
string
$resourceId
= 'default'
$resourceManager
The memcached resource manager
protected
null|MemcachedResourceManager
$resourceManager
$ttl
TTL option
protected
int|float
$ttl
= 0
0 means infinite or maximum of adapter
$writable
Writable option
protected
bool
$writable
= true
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed>|Traversable|null $options = null ]) : mixed
Parameters
- $options : array<string|int, mixed>|Traversable|null = null
Return values
mixed —__get()
Get a configuration property
public
__get(string $key) : mixed
Parameters
- $key : string
Tags
Return values
mixed —__isset()
Test if a configuration property is null
public
__isset(string $key) : bool
Parameters
- $key : string
Tags
Return values
bool —__set()
Set a configuration property
public
__set(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
Tags
Return values
void —__unset()
Set a configuration property to NULL
public
__unset(string $key) : void
Parameters
- $key : string
Tags
Return values
void —addServer()
Add a server to the list
public
addServer(string $host[, int $port = 11211 ], int $weight) : MemcachedOptions
Parameters
- $host : string
- $port : int = 11211
- $weight : int
Tags
Return values
MemcachedOptions —Provides a fluent interface
getKeyPattern()
Get key pattern
public
getKeyPattern() : string
Return values
string —getLibOption()
Get libmemcached option
public
getLibOption(string|int $key) : mixed
Parameters
- $key : string|int
Tags
Return values
mixed —getLibOptions()
Get libmemcached options
public
getLibOptions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getMemcachedResource()
Get memcached resource to share
public
getMemcachedResource() : Memcached
Tags
Return values
Memcached —getNamespace()
Get namespace
public
getNamespace() : string
Return values
string —getNamespaceSeparator()
Get namespace separator
public
getNamespaceSeparator() : string
Return values
string —getPersistentId()
Get the persistent id
public
getPersistentId() : string
Return values
string —getReadable()
If reading data from cache enabled.
public
getReadable() : bool
Return values
bool —getResourceId()
Get the memcached resource id
public
getResourceId() : string
Return values
string —getResourceManager()
Get the memcached resource manager
public
getResourceManager() : MemcachedResourceManager
Return values
MemcachedResourceManager —getServers()
Get Servers
public
getServers() : array<string|int, mixed>
Return values
array<string|int, mixed> —getTtl()
Get time to live.
public
getTtl() : float
Return values
float —getWritable()
If writing data to cache enabled.
public
getWritable() : bool
Return values
bool —setAdapter()
Adapter using this instance
public
setAdapter([StorageInterface|null $adapter = null ]) : AdapterOptions
Parameters
- $adapter : StorageInterface|null = null
Return values
AdapterOptions —Provides a fluent interface
setFromArray()
Set one or more configuration properties
public
setFromArray(array<string|int, mixed>|Traversable|AbstractOptions $options) : AbstractOptions
Parameters
- $options : array<string|int, mixed>|Traversable|AbstractOptions
Tags
Return values
AbstractOptions —Provides fluent interface
setKeyPattern()
Set key pattern
public
setKeyPattern(string $keyPattern) : AdapterOptions
Parameters
- $keyPattern : string
Tags
Return values
AdapterOptions —Provides a fluent interface
setLibOption()
Set libmemcached option
public
setLibOption(string|int $key, mixed $value) : MemcachedOptions
Parameters
- $key : string|int
- $value : mixed
Tags
Return values
MemcachedOptions —Provides a fluent interface
setLibOptions()
Set libmemcached options
public
setLibOptions(array<string|int, mixed> $libOptions) : MemcachedOptions
Parameters
- $libOptions : array<string|int, mixed>
Tags
Return values
MemcachedOptions —Provides a fluent interface
setMemcachedResource()
A memcached resource to share
public
setMemcachedResource([null|Memcached $memcachedResource = null ]) : MemcachedOptions
Parameters
- $memcachedResource : null|Memcached = null
Tags
Return values
MemcachedOptions —Provides a fluent interface
setNamespace()
Set namespace.
public
setNamespace(mixed $namespace) : AdapterOptions
The option Memcached::OPT_PREFIX_KEY will be used as the namespace. It can't be longer than 128 characters.
Parameters
- $namespace : mixed
Tags
Return values
AdapterOptions —Provides a fluent interface
setNamespaceSeparator()
Set namespace separator
public
setNamespaceSeparator(string $namespaceSeparator) : MemcachedOptions
Parameters
- $namespaceSeparator : string
Return values
MemcachedOptions —Provides a fluent interface
setPersistentId()
Set the persistent id
public
setPersistentId(string $persistentId) : MemcachedOptions
Parameters
- $persistentId : string
Return values
MemcachedOptions —Provides a fluent interface
setReadable()
Enable/Disable reading data from cache.
public
setReadable(bool $readable) : AdapterOptions
Parameters
- $readable : bool
Return values
AdapterOptions —Provides a fluent interface
setResourceId()
Set the memcached resource id
public
setResourceId(string $resourceId) : MemcachedOptions
Parameters
- $resourceId : string
Return values
MemcachedOptions —Provides a fluent interface
setResourceManager()
Set the memcached resource manager to use
public
setResourceManager([null|MemcachedResourceManager $resourceManager = null ]) : MemcachedOptions
Parameters
- $resourceManager : null|MemcachedResourceManager = null
Return values
MemcachedOptions —Provides a fluent interface
setServers()
Set a list of memcached servers to add on initialize
public
setServers(string|array<string|int, mixed> $servers) : MemcachedOptions
Parameters
- $servers : string|array<string|int, mixed>
-
list of servers
Tags
Return values
MemcachedOptions —Provides a fluent interface
setTtl()
Set time to live.
public
setTtl(int|float $ttl) : AdapterOptions
Parameters
- $ttl : int|float
Return values
AdapterOptions —Provides a fluent interface
setWritable()
Enable/Disable writing data to cache.
public
setWritable(bool $writable) : AdapterOptions
Parameters
- $writable : bool
Return values
AdapterOptions —Provides a fluent interface
toArray()
Cast to array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —normalizeTtl()
Validates and normalize a TTL.
protected
normalizeTtl(int|float &$ttl) : void
Parameters
- $ttl : int|float
Tags
Return values
void —triggerOptionEvent()
Triggers an option event if this options instance has a connection to an adapter implements EventsCapableInterface.
protected
triggerOptionEvent(string $optionName, mixed $optionValue) : void
Parameters
- $optionName : string
- $optionValue : mixed