Class Memory

Summary

Fully Qualified Name: Zend\Cache\Storage\Adapter\Memory
Extends: AbstractAdapter
Implements: AvailableSpaceCapableInterface, ClearByPrefixInterface, ClearByNamespaceInterface, ClearExpiredInterface, FlushableInterface, IterableInterface, TaggableInterface, TotalSpaceCapableInterface

Description

Methods

Name Description Defined By
__construct() Constructor AbstractAdapter
__destruct() Destructor AbstractAdapter
addItem() Add an item. AbstractAdapter
addItems() Add multiple items. AbstractAdapter
addPlugin() Register a plugin AbstractAdapter
checkAndSetItem() Set an item only if token matches AbstractAdapter
clearByNamespace() Memory
clearByPrefix() Remove items matching given prefix Memory
clearByTags() Remove items matching given tags. Memory
clearExpired() Remove expired items Memory
decrementItem() Decrement an item. AbstractAdapter
decrementItems() Decrement multiple items. AbstractAdapter
flush() Flush the whole storage Memory
getAvailableSpace() Get available space in bytes Memory
getCaching() Get caching enabled. AbstractAdapter
getCapabilities() Get capabilities of this adapter AbstractAdapter
getEventManager() Get the event manager AbstractAdapter
getItem() Get an item. AbstractAdapter
getItems() Get multiple items. AbstractAdapter
getIterator() Get the storage iterator Memory
getMetadata() Get metadata of an item. AbstractAdapter
getMetadatas() Get multiple metadata AbstractAdapter
getOptions() Get options. Memory
getPluginRegistry() Return registry of plugins AbstractAdapter
getTags() Get tags of an item by given key Memory
getTotalSpace() Get total space in bytes Memory
hasItem() Test if an item exists. AbstractAdapter
hasItems() Test multiple items. AbstractAdapter
hasPlugin() Check if a plugin is registered AbstractAdapter
incrementItem() Increment an item. AbstractAdapter
incrementItems() Increment multiple items. AbstractAdapter
removeItem() Remove an item. AbstractAdapter
removeItems() Remove multiple items. AbstractAdapter
removePlugin() Unregister an already registered plugin AbstractAdapter
replaceItem() Replace an existing item. AbstractAdapter
replaceItems() Replace multiple existing items. AbstractAdapter
setCaching() Enable/Disable caching. AbstractAdapter
setItem() Store an item. AbstractAdapter
setItems() Store multiple items. AbstractAdapter
setOptions() Set options. Memory
setTags() Set tags to an item by given key. Memory
touchItem() Reset lifetime of an item AbstractAdapter
touchItems() Reset lifetime of multiple items. AbstractAdapter

Method Details

__construct()

Constructor

Parameter Name Type Description
$options null|array|\Traversable|\AdapterOptions

Returns:

__destruct()

Destructor

detach all registered plugins to free event handles of event manager

Returns: void

addItem()

Add an item.

Parameter Name Type Description
$key string
$value mixed

Returns: bool

addItems()

Add multiple items.

Parameter Name Type Description
$keyValuePairs array

Returns: array Array of not stored keys

addPlugin()

Register a plugin

Parameter Name Type Description
$plugin \Plugin\PluginInterface
$priority int

Returns: \AbstractAdapter Provides a fluent interface

checkAndSetItem()

Set an item only if token matches

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

Parameter Name Type Description
$token mixed
$key string
$value mixed

Returns: bool

clearByNamespace()

Parameter Name Type Description
$namespace

Returns: void

clearByPrefix()

Remove items matching given prefix

Parameter Name Type Description
$prefix string

Returns: bool

clearByTags()

Remove items matching given tags.

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

Parameter Name Type Description
$tags string[]
$disjunction bool

Returns: bool

clearExpired()

Remove expired items

Returns: bool

decrementItem()

Decrement an item.

Parameter Name Type Description
$key string
$value int

Returns: int|bool The new value on success, false on failure

decrementItems()

Decrement multiple items.

Parameter Name Type Description
$keyValuePairs array

Returns: array Associative array of keys and new values

flush()

Flush the whole storage

Returns: bool

getAvailableSpace()

Get available space in bytes

Returns: int|float

getCaching()

Get caching enabled.

Alias of getWritable and getReadable.

Returns: bool

getCapabilities()

Get capabilities of this adapter

Returns: \Capabilities

getEventManager()

Get the event manager

Returns: \EventManagerInterface

getItem()

Get an item.

Parameter Name Type Description
$key string
$success bool
$casToken mixed

Returns: mixed Data on success, null on failure

getItems()

Get multiple items.

Parameter Name Type Description
$keys array

Returns: array Associative array of keys and values

getIterator()

Get the storage iterator

Returns: \KeyListIterator

getMetadata()

Get metadata of an item.

Parameter Name Type Description
$key string

Returns: array|bool Metadata on success, false on failure

getMetadatas()

Get multiple metadata

Parameter Name Type Description
$keys array

Returns: array Associative array of keys and metadata

getOptions()

Get options.

Returns: \MemoryOptions

getPluginRegistry()

Return registry of plugins

Returns: \SplObjectStorage

getTags()

Get tags of an item by given key

Parameter Name Type Description
$key string

Returns: string[]|bool

getTotalSpace()

Get total space in bytes

Returns: int

hasItem()

Test if an item exists.

Parameter Name Type Description
$key string

Returns: bool

hasItems()

Test multiple items.

Parameter Name Type Description
$keys array

Returns: array Array of found keys

hasPlugin()

Check if a plugin is registered

Parameter Name Type Description
$plugin \Plugin\PluginInterface

Returns: bool

incrementItem()

Increment an item.

Parameter Name Type Description
$key string
$value int

Returns: int|bool The new value on success, false on failure

incrementItems()

Increment multiple items.

Parameter Name Type Description
$keyValuePairs array

Returns: array Associative array of keys and new values

removeItem()

Remove an item.

Parameter Name Type Description
$key string

Returns: bool

removeItems()

Remove multiple items.

Parameter Name Type Description
$keys array

Returns: array Array of not removed keys

removePlugin()

Unregister an already registered plugin

Parameter Name Type Description
$plugin \Plugin\PluginInterface

Returns: \AbstractAdapter Provides a fluent interface

replaceItem()

Replace an existing item.

Parameter Name Type Description
$key string
$value mixed

Returns: bool

replaceItems()

Replace multiple existing items.

Parameter Name Type Description
$keyValuePairs array

Returns: array Array of not stored keys

setCaching()

Enable/Disable caching.

Alias of setWritable and setReadable.

Parameter Name Type Description
$flag bool

Returns: \AbstractAdapter Provides a fluent interface

setItem()

Store an item.

Parameter Name Type Description
$key string
$value mixed

Returns: bool

setItems()

Store multiple items.

Parameter Name Type Description
$keyValuePairs array

Returns: array Array of not stored keys

setOptions()

Set options.

Parameter Name Type Description
$options array|\Traversable|\MemoryOptions

Returns: \Memory

setTags()

Set tags to an item by given key.

An empty array will remove all tags.

Parameter Name Type Description
$key string
$tags string[]

Returns: bool

touchItem()

Reset lifetime of an item

Parameter Name Type Description
$key string

Returns: bool

touchItems()

Reset lifetime of multiple items.

Parameter Name Type Description
$keys array

Returns: array Array of not updated keys

Top