Methods

Constructor

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

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

Parameters

$options

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

Exceptions

\Zend\Cache\Exception\ExceptionInterface

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

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) : bool

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

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

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

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

Remove items by given namespace

clearByNamespace(string $namespace) : bool

Parameters

$namespace

string

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

bool

Remove items matching given prefix

clearByPrefix(string $prefix) : bool

Parameters

$prefix

string

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

bool

Remove items matching given tags.

clearByTags(array $tags, bool $disjunction) : bool

If $disjunction only one of the given tags must match else all given tags must match.

Parameters

$tags

string[]

$disjunction

bool

Returns

bool

Remove expired items

clearExpired() : bool

triggers clearExpired.exception(ExceptionEvent)

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

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

bool

Get available space in bytes

getAvailableSpace() : float

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

float

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

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 metadatas

getMetadatas(array $keys, array $options) : array

Parameters

$keys

array

$options

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

arrayAssociative array of keys and metadata

Get options.

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

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

Returns

Return registry of plugins

getPluginRegistry() : \SplObjectStorage
Inherited

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

Returns

Get tags of an item by given key

getTags(string $key) : string[] | FALSE

Parameters

$key

string

Returns

string[]FALSE

Get total space in bytes

getTotalSpace() : int | float

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

intfloat

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

Optimize the storage

optimize() : bool: \Zend\Cache\Exception\RuntimeException

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

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) : bool

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

Parameters

$keyValuePairs

array

Exceptions

\Zend\Cache\Exception\ExceptionInterface

Returns

bool

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

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\FilesystemOptions $options) : \Zend\Cache\Storage\Adapter\Filesystem

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

Parameters

Returns

Set tags to an item by given key.

setTags(string $key, array $tags) : bool

An empty array will remove all tags.

Parameters

$key

string

$tags

string[]

Returns

bool

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

Read a complete file

getFileContent(string $file, bool $nonBlocking, bool $wouldblock) : string

Parameters

$file

string

File complete path

$nonBlocking

bool

Don't block script if file is locked

$wouldblock

bool

The optional argument is set to TRUE if the lock would block

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

string

Get file spec of the given key and namespace

getFileSpec(string $normalizedKey) : string

Parameters

$normalizedKey

string

Returns

string

Internal method to add an item.

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

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

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
Inherited

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

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) : null | mixed

Parameters

$normalizedKey

string

$success

bool

$casToken

mixed

Exceptions

\Zend\Cache\Exception\ExceptionInterface
\Exception

Returns

nullmixedData 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
Inherited

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

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
Inherited

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

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
Inherited

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

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
Inherited

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

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

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

Prepares a directory structure for the given file(spec) using the configured directory level.

prepareDirectoryStructure(string $file) : void

Parameters

$file

string

Exceptions

\Zend\Cache\Exception\RuntimeException

Write content to a file

putFileContent(string $file, string $data, bool $nonBlocking, bool $wouldblock) : void

Parameters

$file

string

File complete path

$data

string

Data to write

$nonBlocking

bool

Don't block script if file is locked

$wouldblock

bool

The optional argument is set to TRUE if the lock would block

Exceptions

\Zend\Cache\Exception\RuntimeException

Read info file

readInfoFile(string $file, bool $nonBlocking, bool $wouldblock) : array | bool

Parameters

$file

string

$nonBlocking

bool

Don't block script if file is locked

$wouldblock

bool

The optional argument is set to TRUE if the lock would block

Exceptions

\Zend\Cache\Exception\RuntimeException

Returns

arrayboolThe info array or false if file wasn't found

Removes directories recursive by namespace

rmDir(string $dir, string $prefix) : bool

Parameters

$dir

string

Directory to delete

$prefix

string

Namespace + Separator

Returns

bool

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 a 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
 

The last used filespec

$lastFileSpec : string

 

An identity for the last filespec (cache directory + namespace prefix + key + directory level)

$lastFileSpecId : string

 

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
 

Buffered total space in bytes

$totalSpace : null | int | float