FileAccess Orion

MemcachedResourceManager
in package

This is a resource manager for memcached

Table of Contents

$resources  : array<string|int, mixed>
Registered resources
addServer()  : MemcachedResourceManager
Add one server
addServers()  : MemcachedResourceManager
Add servers
getLibOption()  : mixed
Get one Libmemcached option
getLibOptions()  : array<string|int, mixed>
Get Libmemcached options
getPersistentId()  : string
Get the persistent id
getResource()  : Memcached
Gets a memcached resource
getServers()  : array<string|int, mixed>
Get servers
hasResource()  : bool
Check if a resource exists
removeResource()  : MemcachedResourceManager
Remove a resource
setLibOption()  : MemcachedResourceManager
Set one Libmemcached option
setLibOptions()  : MemcachedResourceManager
Set Libmemcached options
setPersistentId()  : MemcachedResourceManager
Set the persistent id
setResource()  : MemcachedResourceManager
Set a resource
setServers()  : MemcachedResourceManager
Set servers
compareServers()  : int
Compare 2 normalized server arrays (Compares only the host and the port)
normalizeLibOptionKey()  : mixed
Convert option name into it's constant value
normalizeLibOptions()  : mixed
Normalize libmemcached options
normalizePersistentId()  : mixed
Normalize the persistent id
normalizeServer()  : mixed
Normalize one server into the following format: array('host' => <host>, 'port' => <port>, 'weight' => <weight>)
normalizeServers()  : mixed
Normalize a list of servers into the following format: array(array('host' => <host>, 'port' => <port>, 'weight' => <weight>)[, ...])

Properties

Methods

getLibOption()

Get one Libmemcached option

public getLibOption(string $id, string|int $key) : mixed
Parameters
$id : string
$key : string|int
Tags
throws
RuntimeException
Return values
mixed

getLibOptions()

Get Libmemcached options

public getLibOptions(string $id) : array<string|int, mixed>
Parameters
$id : string
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

getServers()

Get servers

public getServers(string $id) : array<string|int, mixed>
Parameters
$id : string
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

array('host' => , 'port' => , 'weight' => )

hasResource()

Check if a resource exists

public hasResource(string $id) : bool
Parameters
$id : string
Return values
bool

setServers()

Set servers

public setServers(string $id, string|array<string|int, mixed> $servers) : MemcachedResourceManager

$servers can be an array list or a comma separated list of servers. One server in the list can be descripted as follows:

  • URI: [tcp://][:][?weight=]
  • Assoc: array('host' => [, 'port' => ][, 'weight' => ])
  • List: array([, ][, ])
Parameters
$id : string
$servers : string|array<string|int, mixed>
Return values
MemcachedResourceManager

Provides a fluent interface

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

normalizeLibOptions()

Normalize libmemcached options

protected normalizeLibOptions(array<string|int, mixed>|Traversable &$libOptions) : mixed
Parameters
$libOptions : array<string|int, mixed>|Traversable
Tags
throws
InvalidArgumentException
Return values
mixed

normalizePersistentId()

Normalize the persistent id

protected normalizePersistentId(string &$persistentId) : mixed
Parameters
$persistentId : string
Return values
mixed

normalizeServer()

Normalize one server into the following format: array('host' => <host>, 'port' => <port>, 'weight' => <weight>)

protected normalizeServer(string|array<string|int, mixed> &$server) : mixed
Parameters
$server : string|array<string|int, mixed>
Tags
throws
InvalidArgumentException
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

Search results