StorageInterface
in
Table of Contents
- addItem() : bool
- Add an item.
- addItems() : array<string|int, mixed>
- Add multiple items.
- checkAndSetItem() : bool
- Set an item only if token matches
- decrementItem() : int|bool
- Decrement an item.
- decrementItems() : array<string|int, mixed>
- Decrement multiple items.
- getCapabilities() : Capabilities
- Capabilities of this storage
- getItem() : mixed
- Get an item.
- getItems() : array<string|int, mixed>
- Get multiple items.
- getMetadata() : array<string|int, mixed>|bool
- Get metadata of an item.
- getMetadatas() : array<string|int, mixed>
- Get multiple metadata
- getOptions() : AdapterOptions
- Get options
- hasItem() : bool
- Test if an item exists.
- hasItems() : array<string|int, mixed>
- Test multiple items.
- incrementItem() : int|bool
- Increment an item.
- incrementItems() : array<string|int, mixed>
- Increment multiple items.
- removeItem() : bool
- Remove an item.
- removeItems() : array<string|int, mixed>
- Remove multiple items.
- replaceItem() : bool
- Replace an existing item.
- replaceItems() : array<string|int, mixed>
- Replace multiple existing items.
- setItem() : bool
- Store an item.
- setItems() : array<string|int, mixed>
- Store multiple items.
- setOptions() : StorageInterface
- Set options.
- touchItem() : bool
- Reset lifetime of an item
- touchItems() : array<string|int, mixed>
- Reset lifetime of multiple items.
Methods
addItem()
Add an item.
public
addItem(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Tags
Return values
bool —addItems()
Add multiple items.
public
addItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of not stored keys
checkAndSetItem()
Set an item only if token matches
public
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.
Parameters
- $token : mixed
- $key : string
- $value : mixed
Tags
Return values
bool —decrementItem()
Decrement an item.
public
decrementItem(string $key, int $value) : int|bool
Parameters
- $key : string
- $value : int
Tags
Return values
int|bool —The new value on success, false on failure
decrementItems()
Decrement multiple items.
public
decrementItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Associative array of keys and new values
getCapabilities()
Capabilities of this storage
public
getCapabilities() : Capabilities
Return values
Capabilities —getItem()
Get an item.
public
getItem(string $key[, bool &$success = null ][, mixed &$casToken = null ]) : mixed
Parameters
- $key : string
- $success : bool = null
- $casToken : mixed = null
Tags
Return values
mixed —Data on success, null on failure
getItems()
Get multiple items.
public
getItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Associative array of keys and values
getMetadata()
Get metadata of an item.
public
getMetadata(string $key) : array<string|int, mixed>|bool
Parameters
- $key : string
Tags
Return values
array<string|int, mixed>|bool —Metadata on success, false on failure
getMetadatas()
Get multiple metadata
public
getMetadatas(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Associative array of keys and metadata
getOptions()
Get options
public
getOptions() : AdapterOptions
Return values
AdapterOptions —hasItem()
Test if an item exists.
public
hasItem(string $key) : bool
Parameters
- $key : string
Tags
Return values
bool —hasItems()
Test multiple items.
public
hasItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of found keys
incrementItem()
Increment an item.
public
incrementItem(string $key, int $value) : int|bool
Parameters
- $key : string
- $value : int
Tags
Return values
int|bool —The new value on success, false on failure
incrementItems()
Increment multiple items.
public
incrementItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Associative array of keys and new values
removeItem()
Remove an item.
public
removeItem(string $key) : bool
Parameters
- $key : string
Tags
Return values
bool —removeItems()
Remove multiple items.
public
removeItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of not removed keys
replaceItem()
Replace an existing item.
public
replaceItem(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Tags
Return values
bool —replaceItems()
Replace multiple existing items.
public
replaceItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of not stored keys
setItem()
Store an item.
public
setItem(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Tags
Return values
bool —setItems()
Store multiple items.
public
setItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of not stored keys
setOptions()
Set options.
public
setOptions(array<string|int, mixed>|Traversable|AdapterOptions $options) : StorageInterface
Parameters
- $options : array<string|int, mixed>|Traversable|AdapterOptions
Return values
StorageInterface —Fluent interface
touchItem()
Reset lifetime of an item
public
touchItem(string $key) : bool
Parameters
- $key : string
Tags
Return values
bool —touchItems()
Reset lifetime of multiple items.
public
touchItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of not updated keys