category Zend
package Zend_Cache
subpackage Storage

 Methods

Constructor

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

Parameters

$options

nullarray\Traversable\Zend\Cache\Storage\Adapter\AdapterOptions

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Destructor

__destruct() : void

detach all registered plugins to free event handles of event manager

Add an item.

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

triggers addItem.pre(PreEvent)
triggers addItem.post(PostEvent)
triggers addItem.exception(ExceptionEvent)

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Add multiple items.

addItems(array $keyValuePairs) : array

triggers addItems.pre(PreEvent)
triggers addItems.post(PostEvent)
triggers addItems.exception(ExceptionEvent)

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

Set an item only if token matches

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

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()

Parameters

$token

mixed

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Decrement an item.

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

triggers decrementItem.pre(PreEvent)
triggers decrementItem.post(PostEvent)
triggers decrementItem.exception(ExceptionEvent)

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

triggers incrementItems.pre(PreEvent)
triggers incrementItems.post(PostEvent)
triggers incrementItems.exception(ExceptionEvent)

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Get caching enabled.

getCaching() : bool

Alias of getWritable and getReadable.

see \Zend\Cache\Storage\Adapter\getWritable()
see \Zend\Cache\Storage\Adapter\getReadable()

Returns

bool

Get capabilities of this adapter

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

triggers getCapabilities.pre(PreEvent)
triggers getCapabilities.post(PostEvent)
triggers getCapabilities.exception(ExceptionEvent)

Returns

Get the event manager

getEventManager() : \Zend\EventManager\EventManagerInterface

Lazy-loads an EventManager instance if none registered.

Returns

Get an item.

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

triggers getItem.pre(PreEvent)
triggers getItem.post(PostEvent)
triggers getItem.exception(ExceptionEvent)

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

triggers getItems.pre(PreEvent)
triggers getItems.post(PostEvent)
triggers getItems.exception(ExceptionEvent)

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and values

Get multiple metadata

getMetadatas(array $keys) : array

triggers getMetadatas.pre(PreEvent)
triggers getMetadatas.post(PostEvent)
triggers getMetadatas.exception(ExceptionEvent)

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and metadata

Get options.

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

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

Returns

Return registry of plugins

getPluginRegistry() : \SplObjectStorage

Test if an item exists.

hasItem(string $key) : bool

triggers hasItem.pre(PreEvent)
triggers hasItem.post(PostEvent)
triggers hasItem.exception(ExceptionEvent)

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Test multiple items.

hasItems(array $keys) : array

triggers hasItems.pre(PreEvent)
triggers hasItems.post(PostEvent)
triggers hasItems.exception(ExceptionEvent)

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

Parameters

Returns

bool

Increment an item.

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

triggers incrementItem.pre(PreEvent)
triggers incrementItem.post(PostEvent)
triggers incrementItem.exception(ExceptionEvent)

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

triggers incrementItems.pre(PreEvent)
triggers incrementItems.post(PostEvent)
triggers incrementItems.exception(ExceptionEvent)

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and new values

Remove an item.

removeItem(string $key) : bool

triggers removeItem.pre(PreEvent)
triggers removeItem.post(PostEvent)
triggers removeItem.exception(ExceptionEvent)

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Remove multiple items.

removeItems(array $keys) : array

triggers removeItems.pre(PreEvent)
triggers removeItems.post(PostEvent)
triggers removeItems.exception(ExceptionEvent)

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

Replace an existing item.

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

triggers replaceItem.pre(PreEvent)
triggers replaceItem.post(PostEvent)
triggers replaceItem.exception(ExceptionEvent)

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Replace multiple existing items.

replaceItems(array $keyValuePairs) : array

triggers replaceItems.pre(PreEvent)
triggers replaceItems.post(PostEvent)
triggers replaceItems.exception(ExceptionEvent)

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

Alias of setWritable and setReadable.

see \Zend\Cache\Storage\Adapter\setWritable()
see \Zend\Cache\Storage\Adapter\setReadable()

Parameters

$flag

bool

Returns

Store an item.

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

triggers setItem.pre(PreEvent)
triggers setItem.post(PostEvent)
triggers setItem.exception(ExceptionEvent)

Parameters

$key

string

$value

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Store multiple items.

setItems(array $keyValuePairs) : array

triggers setItems.pre(PreEvent)
triggers setItems.post(PostEvent)
triggers setItems.exception(ExceptionEvent)

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not stored keys

Set options.

setOptions(array | \Traversable | \Zend\Cache\Storage\Adapter\AdapterOptions $options) : \Zend\Cache\Storage\Adapter\AbstractAdapter

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

Parameters

$options

array\Traversable\Zend\Cache\Storage\Adapter\AdapterOptions

Returns

Reset lifetime of an item

touchItem(string $key) : bool

triggers touchItem.pre(PreEvent)
triggers touchItem.post(PostEvent)
triggers touchItem.exception(ExceptionEvent)

Parameters

$key

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Reset lifetime of multiple items.

touchItems(array $keys) : array

triggers touchItems.pre(PreEvent)
triggers touchItems.post(PostEvent)
triggers touchItems.exception(ExceptionEvent)

Parameters

$keys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not updated keys

Internal method to 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

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

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

Internal method to get multiple metadata

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

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

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

Parameters

$normalizedKey

string

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

Internal method to reset lifetime of multiple items.

internalTouchItems(array $normalizedKeys) : array

Parameters

$normalizedKeys

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayArray of not updated keys

Validates and normalizes a key

normalizeKey(string $key) : void

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

Parameters

$keyValuePairs

array

Exceptions

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

Validates and normalizes multiple keys

normalizeKeys(array $keys) : void

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

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

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

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

Parameters

$eventName

string

$args

\ArrayObject

Returns

\Zend\EventManager\ResponseCollectionAll handler return values

 Properties

 

Capabilities of this adapter

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

 

Marker to change capabilities

$capabilityMarker : null | object

 

Event handles of this adapter

$eventHandles : array

 

The used EventManager if any

$events : null | \Zend\EventManager\EventManagerInterface

 

options

$options : mixed

 

The plugin registry

$pluginRegistry : \SplObjectStorage