MemcacheResourceManager
in package
This is a resource manager for memcache
Table of Contents
- $failureCallbacks : array<string|int, callable>
- Failure callback per resource
- $resources : array<string|int, mixed>
- Registered resources
- $serverDefaults : array<string|int, mixed>
- Default server values per resource
- addServer() : MemcacheResourceManager
- Add one server
- addServers() : MemcacheResourceManager
- Add servers
- getAutoCompressMinSavings() : float|null
- Get compress min savings
- getAutoCompressThreshold() : int|null
- Get compress threshold
- getFailureCallback() : callable
- Get callback for server connection failures
- getResource() : Memcache
- Gets a memcache resource
- getServerDefaults() : array<string|int, mixed>
- Get default server values
- getServers() : array<string|int, mixed>
- Get servers
- hasResource() : bool
- Check if a resource exists
- removeResource() : MemcacheResourceManager
- Remove a resource
- setAutoCompressMinSavings() : MemcacheResourceManager
- Set compress min savings
- setAutoCompressThreshold() : MemcacheResourceManager
- Set compress threshold
- setFailureCallback() : MemcacheResourceManager
- Set callback for server connection failures
- setResource() : MemcacheResourceManager
- Set a resource
- setServerDefaults() : MemcacheResourceManager
- Set default server values array( 'persistent' => <persistent>, 'weight' => <weight>, 'timeout' => <timeout>, 'retry_interval' => <retryInterval>, )
- addServerToResource() : mixed
- compareServers() : int
- Compare 2 normalized server arrays (Compares only the host and the port)
- normalizeAutoCompressThreshold() : mixed
- Normalize compress threshold options
- normalizeServer() : mixed
- Normalize one server into the following format: array( 'host' => <host>, 'port' => <port>, 'weight' => <weight>, 'status' => <status>, 'persistent' => <persistent>, 'timeout' => <timeout>, 'retry_interval' => <retryInterval>, )
- normalizeServerDefaults() : mixed
- normalizeServers() : mixed
- Normalize a list of servers into the following format: array(array('host' => <host>, 'port' => <port>, 'weight' => <weight>)[, ...])
- setResourceAutoCompressThreshold() : mixed
- Set compress threshold on a Memcache resource
Properties
$failureCallbacks
Failure callback per resource
protected
array<string|int, callable>
$failureCallbacks
= []
$resources
Registered resources
protected
array<string|int, mixed>
$resources
= []
$serverDefaults
Default server values per resource
protected
array<string|int, mixed>
$serverDefaults
= []
Methods
addServer()
Add one server
public
addServer(string $id, string|array<string|int, mixed> $server) : MemcacheResourceManager
Parameters
- $id : string
- $server : string|array<string|int, mixed>
Return values
MemcacheResourceManager —addServers()
Add servers
public
addServers(string $id, string|array<string|int, mixed> $servers) : MemcacheResourceManager
Parameters
- $id : string
- $servers : string|array<string|int, mixed>
Return values
MemcacheResourceManager —Provides a fluent interface
getAutoCompressMinSavings()
Get compress min savings
public
getAutoCompressMinSavings(string $id) : float|null
Parameters
- $id : string
Tags
Return values
float|null —getAutoCompressThreshold()
Get compress threshold
public
getAutoCompressThreshold(string $id) : int|null
Parameters
- $id : string
Tags
Return values
int|null —getFailureCallback()
Get callback for server connection failures
public
getFailureCallback(string $id) : callable
Parameters
- $id : string
Tags
Return values
callable —getResource()
Gets a memcache resource
public
getResource(string $id) : Memcache
Parameters
- $id : string
Tags
Return values
Memcache —getServerDefaults()
Get default server values
public
getServerDefaults(string $id) : array<string|int, mixed>
Parameters
- $id : string
Tags
Return values
array<string|int, mixed> —getServers()
Get servers
public
getServers(string $id) : array<string|int, mixed>
Parameters
- $id : string
Tags
Return values
array<string|int, mixed> —array('host' =>
hasResource()
Check if a resource exists
public
hasResource(string $id) : bool
Parameters
- $id : string
Return values
bool —removeResource()
Remove a resource
public
removeResource(string $id) : MemcacheResourceManager
Parameters
- $id : string
Return values
MemcacheResourceManager —Provides a fluent interface
setAutoCompressMinSavings()
Set compress min savings
public
setAutoCompressMinSavings(string $id, float|string|null $minSavings) : MemcacheResourceManager
Parameters
- $id : string
- $minSavings : float|string|null
Tags
Return values
MemcacheResourceManager —Provides a fluent interface
setAutoCompressThreshold()
Set compress threshold
public
setAutoCompressThreshold(string $id, int|string|array<string|int, mixed>|ArrayAccess|null $threshold[, float|string|bool $minSavings = false ]) : MemcacheResourceManager
Parameters
- $id : string
- $threshold : int|string|array<string|int, mixed>|ArrayAccess|null
- $minSavings : float|string|bool = false
Return values
MemcacheResourceManager —Provides a fluent interface
setFailureCallback()
Set callback for server connection failures
public
setFailureCallback(string $id, callable|null $failureCallback) : MemcacheResourceManager
Parameters
- $id : string
- $failureCallback : callable|null
Return values
MemcacheResourceManager —Provides a fluent interface
setResource()
Set a resource
public
setResource(string $id, array<string|int, mixed>|Traversable|Memcache $resource[, callable $failureCallback = null ][, array<string|int, mixed>|Traversable $serverDefaults = [] ]) : MemcacheResourceManager
Parameters
- $id : string
- $resource : array<string|int, mixed>|Traversable|Memcache
- $failureCallback : callable = null
- $serverDefaults : array<string|int, mixed>|Traversable = []
Return values
MemcacheResourceManager —Provides a fluent interface
setServerDefaults()
Set default server values array( 'persistent' => <persistent>, 'weight' => <weight>, 'timeout' => <timeout>, 'retry_interval' => <retryInterval>, )
public
setServerDefaults(string $id, array<string|int, mixed> $serverDefaults) : MemcacheResourceManager
Parameters
- $id : string
- $serverDefaults : array<string|int, mixed>
Return values
MemcacheResourceManager —Provides a fluent interface
addServerToResource()
protected
addServerToResource(Memcache $resource, array<string|int, mixed> $server, array<string|int, mixed> $serverDefaults, callable|null $failureCallback) : mixed
Parameters
- $resource : Memcache
- $server : array<string|int, mixed>
- $serverDefaults : array<string|int, mixed>
- $failureCallback : callable|null
Return values
mixed —compareServers()
Compare 2 normalized server arrays (Compares only the host and the port)
protected
compareServers(array<string|int, mixed> $serverA, array<string|int, mixed> $serverB) : int
Parameters
- $serverA : array<string|int, mixed>
- $serverB : array<string|int, mixed>
Return values
int —normalizeAutoCompressThreshold()
Normalize compress threshold options
protected
normalizeAutoCompressThreshold(int|string|array<string|int, mixed>|ArrayAccess &$threshold, float|string &$minSavings) : mixed
Parameters
- $threshold : int|string|array<string|int, mixed>|ArrayAccess
- $minSavings : float|string
Return values
mixed —normalizeServer()
Normalize one server into the following format: array( 'host' => <host>, 'port' => <port>, 'weight' => <weight>, 'status' => <status>, 'persistent' => <persistent>, 'timeout' => <timeout>, 'retry_interval' => <retryInterval>, )
protected
normalizeServer(string|array<string|int, mixed> &$server) : mixed
Parameters
- $server : string|array<string|int, mixed>
Tags
Return values
mixed —normalizeServerDefaults()
protected
normalizeServerDefaults(array<string|int, mixed> &$serverDefaults) : mixed
Parameters
- $serverDefaults : array<string|int, mixed>
Tags
Return values
mixed —normalizeServers()
Normalize a list of servers into the following format: array(array('host' => <host>, 'port' => <port>, 'weight' => <weight>)[, ...])
protected
normalizeServers(string|array<string|int, mixed> &$servers) : mixed
Parameters
- $servers : string|array<string|int, mixed>
Return values
mixed —setResourceAutoCompressThreshold()
Set compress threshold on a Memcache resource
protected
setResourceAutoCompressThreshold(Memcache $resource, int $threshold, float $minSavings) : mixed
Parameters
- $resource : Memcache
- $threshold : int
- $minSavings : float