package Zend_Cache
subpackage Zend_Cache_Storage
subpackage Storage

 Methods

Constructor

__construct(null | array | \Traversable | \Zend\Cache\Storage\Adapter\MemcachedOptions $options) 

Destructor

__destruct() : void
Inherited

detach all registered plugins to free event handles of event manager

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::__destruct()

Add an item.

addItem(string $key, mixed $value) : bool
Inherited

triggers addItem.pre(PreEvent)
triggers addItem.post(PostEvent)
triggers addItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::addItem()

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Add multiple items.

addItems(array $keyValuePairs) : array
Inherited

triggers addItems.pre(PreEvent)
triggers addItems.post(PostEvent)
triggers addItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::addItems()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Register a plugin

addPlugin(\Zend\Cache\Storage\Plugin\PluginInterface $plugin, int $priority) : \Zend\Cache\Storage\Adapter\AbstractAdapter
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::addPlugin()

Parameters

$priority

int

Exceptions

\Zend\Cache\Exception\LogicException

Returns

Set an item only if token matches

checkAndSetItem(mixed $token, string $key, mixed $value) : bool
Inherited

It uses the token received from getItem() to check if the item has changed before overwriting it.

see \Zend\Cache\Storage\Adapter\getItem()
see \Zend\Cache\Storage\Adapter\setItem()
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::checkAndSetItem()

Parameters

$token

mixed

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Decrement an item.

decrementItem(string $key, int $value) : int | bool
Inherited

triggers decrementItem.pre(PreEvent)
triggers decrementItem.post(PostEvent)
triggers decrementItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::decrementItem()

Parameters

$key

string

$value

int

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

intboolThe new value on success, false on failure

Decrement multiple items.

decrementItems(array $keyValuePairs) : array
Inherited

triggers incrementItems.pre(PreEvent)
triggers incrementItems.post(PostEvent)
triggers incrementItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::decrementItems()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Flush the whole storage

flush() : bool

Returns

bool

Get available space in bytes

getAvailableSpace() : int | float

Returns

intfloat

Get caching enabled.

getCaching() : bool
Inherited

Alias of getWritable and getReadable.

see \Zend\Cache\Storage\Adapter\getWritable()
see \Zend\Cache\Storage\Adapter\getReadable()
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getCaching()

Returns

bool

Get capabilities of this adapter

getCapabilities() : \Zend\Cache\Storage\Capabilities
Inherited

triggers getCapabilities.pre(PreEvent)
triggers getCapabilities.post(PostEvent)
triggers getCapabilities.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getCapabilities()

Returns

Get the event manager

getEventManager() : \Zend\EventManager\EventManagerInterface
Inherited

Lazy-loads an EventManager instance if none registered.

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getEventManager()

Returns

Get an item.

getItem(string $key, bool $success, mixed $casToken) : mixed
Inherited

triggers getItem.pre(PreEvent)
triggers getItem.post(PostEvent)
triggers getItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getItem()

Parameters

$key

string

$success

bool

$casToken

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

mixedData on success, null on failure

Get multiple items.

getItems(array $keys) : array
Inherited

triggers getItems.pre(PreEvent)
triggers getItems.post(PostEvent)
triggers getItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getItems()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and values

Get multiple metadata

getMetadatas(array $keys) : array
Inherited

triggers getMetadatas.pre(PreEvent)
triggers getMetadatas.post(PostEvent)
triggers getMetadatas.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getMetadatas()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and metadata

Get options.

getOptions() : \Zend\Cache\Storage\Adapter\MemcachedOptions

see \Zend\Cache\Storage\Adapter\setOptions()

Returns

Return registry of plugins

getPluginRegistry() : \SplObjectStorage
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::getPluginRegistry()

Returns

Get total space in bytes

getTotalSpace() : int | float

Returns

intfloat

Test if an item exists.

hasItem(string $key) : bool
Inherited

triggers hasItem.pre(PreEvent)
triggers hasItem.post(PostEvent)
triggers hasItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::hasItem()

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Test multiple items.

hasItems(array $keys) : array
Inherited

triggers hasItems.pre(PreEvent)
triggers hasItems.post(PostEvent)
triggers hasItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::hasItems()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of found keys

Check if a plugin is registered

hasPlugin(\Zend\Cache\Storage\Plugin\PluginInterface $plugin) : bool
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::hasPlugin()

Parameters

Returns

bool

Increment an item.

incrementItem(string $key, int $value) : int | bool
Inherited

triggers incrementItem.pre(PreEvent)
triggers incrementItem.post(PostEvent)
triggers incrementItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::incrementItem()

Parameters

$key

string

$value

int

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

intboolThe new value on success, false on failure

Increment multiple items.

incrementItems(array $keyValuePairs) : array
Inherited

triggers incrementItems.pre(PreEvent)
triggers incrementItems.post(PostEvent)
triggers incrementItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::incrementItems()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Remove an item.

removeItem(string $key) : bool
Inherited

triggers removeItem.pre(PreEvent)
triggers removeItem.post(PostEvent)
triggers removeItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::removeItem()

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Remove multiple items.

removeItems(array $keys) : array
Inherited

triggers removeItems.pre(PreEvent)
triggers removeItems.post(PostEvent)
triggers removeItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::removeItems()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not removed keys

Unregister an already registered plugin

removePlugin(\Zend\Cache\Storage\Plugin\PluginInterface $plugin) : \Zend\Cache\Storage\Adapter\AbstractAdapter
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::removePlugin()

Parameters

Exceptions

\Zend\Cache\Exception\LogicException

Returns

Replace an existing item.

replaceItem(string $key, mixed $value) : bool
Inherited

triggers replaceItem.pre(PreEvent)
triggers replaceItem.post(PostEvent)
triggers replaceItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::replaceItem()

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Replace multiple existing items.

replaceItems(array $keyValuePairs) : array
Inherited

triggers replaceItems.pre(PreEvent)
triggers replaceItems.post(PostEvent)
triggers replaceItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::replaceItems()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Enable/Disable caching.

setCaching(bool $flag) : \Zend\Cache\Storage\Adapter\AbstractAdapter
Inherited

Alias of setWritable and setReadable.

see \Zend\Cache\Storage\Adapter\setWritable()
see \Zend\Cache\Storage\Adapter\setReadable()
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::setCaching()

Parameters

$flag

bool

Returns

Store an item.

setItem(string $key, mixed $value) : bool
Inherited

triggers setItem.pre(PreEvent)
triggers setItem.post(PostEvent)
triggers setItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::setItem()

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Store multiple items.

setItems(array $keyValuePairs) : array
Inherited

triggers setItems.pre(PreEvent)
triggers setItems.post(PostEvent)
triggers setItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::setItems()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Set options.

setOptions(array | \Traversable | \Zend\Cache\Storage\Adapter\MemcachedOptions $options) : \Zend\Cache\Storage\Adapter\Memcached

see \Zend\Cache\Storage\Adapter\getOptions()

Parameters

Returns

Reset lifetime of an item

touchItem(string $key) : bool
Inherited

triggers touchItem.pre(PreEvent)
triggers touchItem.post(PostEvent)
triggers touchItem.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::touchItem()

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Reset lifetime of multiple items.

touchItems(array $keys) : array
Inherited

triggers touchItems.pre(PreEvent)
triggers touchItems.post(PostEvent)
triggers touchItems.exception(ExceptionEvent)
inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::touchItems()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not updated keys

Get expiration time by ttl

expirationTime() : int

Some storage commands involve sending an expiration value (relative to an item or to an operation requested by the client) to the server. In all such cases, the actual value sent may either be Unix time (number of seconds since January 1, 1970, as an integer), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 606024*30 (number of seconds in 30 days); if the expiration value is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.

Returns

int

Generate exception based of memcached result code

getExceptionByResultCode(int $code) : \Zend\Cache\Exception\RuntimeException

Parameters

$code

int

Exceptions

\Zend\Cache\Exception\InvalidArgumentException On success code

Returns

Initialize the internal memcached resource

getMemcachedResource() : \Memcached

Returns

Add an item.

internalAddItem(string $normalizedKey, mixed $value) : bool

Parameters

$normalizedKey

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to add multiple items.

internalAddItems(array $normalizedKeyValuePairs) : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalAddItems()

Parameters

$normalizedKeyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Internal method to set an item only if token matches

internalCheckAndSetItem(mixed $token, string $normalizedKey, mixed $value) : bool

see \Zend\Cache\Storage\Adapter\getItem()
see \Zend\Cache\Storage\Adapter\setItem()

Parameters

$token

mixed

$normalizedKey

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to decrement an item.

internalDecrementItem(string $normalizedKey, int $value) : int | bool

Parameters

$normalizedKey

string

$value

int

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

intboolThe new value on success, false on failure

Internal method to decrement multiple items.

internalDecrementItems(array $normalizedKeyValuePairs) : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalDecrementItems()

Parameters

$normalizedKeyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Internal method to get capabilities of this adapter

internalGetCapabilities() : \Zend\Cache\Storage\Capabilities

Internal method to get an item.

internalGetItem(string $normalizedKey, bool $success, mixed $casToken) : mixed

Parameters

$normalizedKey

string

$success

bool

$casToken

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

mixedData on success, null on failure

Internal method to get multiple items.

internalGetItems(array $normalizedKeys) : array

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and values

Get metadata of multiple items

internalGetMetadatas(array $normalizedKeys) : array

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and metadata

Internal method to test if an item exists.

internalHasItem(string $normalizedKey) : bool

Parameters

$normalizedKey

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to test multiple items.

internalHasItems(array $normalizedKeys) : array

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of found keys

Internal method to increment an item.

internalIncrementItem(string $normalizedKey, int $value) : int | bool

Parameters

$normalizedKey

string

$value

int

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

intboolThe new value on success, false on failure

Internal method to increment multiple items.

internalIncrementItems(array $normalizedKeyValuePairs) : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalIncrementItems()

Parameters

$normalizedKeyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Internal method to remove an item.

internalRemoveItem(string $normalizedKey) : bool

Parameters

$normalizedKey

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to remove multiple items.

internalRemoveItems(array $normalizedKeys) : array

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not removed keys

Internal method to replace an existing item.

internalReplaceItem(string $normalizedKey, mixed $value) : bool

Parameters

$normalizedKey

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to replace multiple existing items.

internalReplaceItems(array $normalizedKeyValuePairs) : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalReplaceItems()

Parameters

$normalizedKeyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Internal method to store an item.

internalSetItem(string $normalizedKey, mixed $value) : bool

Parameters

$normalizedKey

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to store multiple items.

internalSetItems(array $normalizedKeyValuePairs) : array

Parameters

$normalizedKeyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Internal method to reset lifetime of an item

internalTouchItem(string $normalizedKey) : bool
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalTouchItem()

Parameters

$normalizedKey

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to reset lifetime of multiple items.

internalTouchItems(array $normalizedKeys) : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::internalTouchItems()

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not updated keys

Validates and normalizes a key

normalizeKey(string $key) : void
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::normalizeKey()

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\InvalidArgumentException On an invalid key

Validates and normalizes an array of key-value pairs

normalizeKeyValuePairs(array $keyValuePairs) : void
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::normalizeKeyValuePairs()

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\InvalidArgumentException On an invalid key

Validates and normalizes multiple keys

normalizeKeys(array $keys) : void
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::normalizeKeys()

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\InvalidArgumentException On an invalid key

Trigger an exception event

triggerException(string $eventName, \ArrayObject $args, mixed $result, \Exception $exception) : mixed
Inherited

If the ExceptionEvent has the flag "throwException" enabled throw the exception after trigger else return the result.

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::triggerException()

Parameters

$eventName

string

$args

\ArrayObject

$result

mixed

$exception

\Exception

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

mixed

Triggers the PostEvent and return the result value.

triggerPost(string $eventName, \ArrayObject $args, mixed $result) : mixed
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::triggerPost()

Parameters

$eventName

string

$args

\ArrayObject

$result

mixed

Returns

mixed

Trigger an pre event and return the event response collection

triggerPre(string $eventName, \ArrayObject $args) : \Zend\EventManager\ResponseCollection
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::triggerPre()

Parameters

$eventName

string

$args

\ArrayObject

Returns

\Zend\EventManager\ResponseCollectionAll handler return values

 Properties

 

Capabilities of this adapter

$capabilities : null | \Zend\Cache\Storage\Capabilities
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$capabilities
 

Marker to change capabilities

$capabilityMarker : null | object
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$capabilityMarker
 

Event handles of this adapter

$eventHandles : array
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$eventHandles
 

The used EventManager if any

$events : null | \Zend\EventManager\EventManagerInterface
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$events
 

Major version of ext/memcached

$extMemcachedMajorVersion : null | int

 

The memcached resource

$memcachedResource : \Memcached

 

options

$options : mixed
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$options
 

The plugin registry

$pluginRegistry : \SplObjectStorage
Inherited

inherited_from \Zend\Cache\Storage\Adapter\AbstractAdapter::$$pluginRegistry