BlackHole
in package
implements
StorageInterface, AvailableSpaceCapableInterface, ClearByNamespaceInterface, ClearByPrefixInterface, ClearExpiredInterface, FlushableInterface, IterableInterface, OptimizableInterface, TaggableInterface, TotalSpaceCapableInterface
Interfaces, Classes, Traits and Enums
- StorageInterface
- AvailableSpaceCapableInterface
- ClearByNamespaceInterface
- ClearByPrefixInterface
- ClearExpiredInterface
- FlushableInterface
- IterableInterface
- OptimizableInterface
- TaggableInterface
- TotalSpaceCapableInterface
Table of Contents
- $capabilities : null|Capabilities
- Capabilities of this adapter
- $capabilityMarker : null|object
- Marker to change capabilities
- $options : null|AdapterOptions
- options
- __construct() : mixed
- Constructor
- addItem() : bool
- Add an item.
- addItems() : array<string|int, mixed>
- Add multiple items.
- checkAndSetItem() : bool
- Set an item only if token matches
- clearByNamespace() : bool
- Remove items of given namespace
- clearByPrefix() : bool
- Remove items matching given prefix
- clearByTags() : bool
- Remove items matching given tags.
- clearExpired() : bool
- Remove expired items
- decrementItem() : int|bool
- Decrement an item.
- decrementItems() : array<string|int, mixed>
- Decrement multiple items.
- flush() : bool
- Flush the whole storage
- getAvailableSpace() : int|float
- Get available space in bytes
- getCapabilities() : Capabilities
- Capabilities of this storage
- getItem() : mixed
- Get an item.
- getItems() : array<string|int, mixed>
- Get multiple items.
- getIterator() : KeyListIterator
- Get the storage iterator
- getMetadata() : array<string|int, mixed>|bool
- Get metadata of an item.
- getMetadatas() : array<string|int, mixed>
- Get multiple metadata
- getOptions() : AdapterOptions
- Get options
- getTags() : array<string|int, string>|false
- Get tags of an item by given key
- getTotalSpace() : int|float
- Get total space in bytes
- 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.
- optimize() : bool
- Optimize the storage
- 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() : BlackHole
- Set options.
- setTags() : bool
- Set tags to an item by given key.
- touchItem() : bool
- Reset lifetime of an item
- touchItems() : array<string|int, mixed>
- Reset lifetime of multiple items.
Properties
$capabilities
Capabilities of this adapter
protected
null|Capabilities
$capabilities
= null
$capabilityMarker
Marker to change capabilities
protected
null|object
$capabilityMarker
$options
options
protected
null|AdapterOptions
$options
Methods
__construct()
Constructor
public
__construct([null|array<string|int, mixed>|Traversable|AdapterOptions $options = null ]) : mixed
Parameters
- $options : null|array<string|int, mixed>|Traversable|AdapterOptions = null
Return values
mixed —addItem()
Add an item.
public
addItem(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Return values
bool —addItems()
Add multiple items.
public
addItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
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
Return values
bool —clearByNamespace()
Remove items of given namespace
public
clearByNamespace(string $namespace) : bool
Parameters
- $namespace : string
Return values
bool —clearByPrefix()
Remove items matching given prefix
public
clearByPrefix(string $prefix) : bool
Parameters
- $prefix : string
Return values
bool —clearByTags()
Remove items matching given tags.
public
clearByTags(array<string|int, string> $tags[, bool $disjunction = false ]) : bool
If $disjunction only one of the given tags must match else all given tags must match.
Parameters
- $tags : array<string|int, string>
- $disjunction : bool = false
Return values
bool —clearExpired()
Remove expired items
public
clearExpired() : bool
Return values
bool —decrementItem()
Decrement an item.
public
decrementItem(string $key, int $value) : int|bool
Parameters
- $key : string
- $value : int
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>
Return values
array<string|int, mixed> —Associative array of keys and new values
flush()
Flush the whole storage
public
flush() : bool
Return values
bool —getAvailableSpace()
Get available space in bytes
public
getAvailableSpace() : int|float
Return values
int|float —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
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>
Return values
array<string|int, mixed> —Associative array of keys and values
getIterator()
Get the storage iterator
public
getIterator() : KeyListIterator
Return values
KeyListIterator —getMetadata()
Get metadata of an item.
public
getMetadata(string $key) : array<string|int, mixed>|bool
Parameters
- $key : string
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>
Return values
array<string|int, mixed> —Associative array of keys and metadata
getOptions()
Get options
public
getOptions() : AdapterOptions
Return values
AdapterOptions —getTags()
Get tags of an item by given key
public
getTags(string $key) : array<string|int, string>|false
Parameters
- $key : string
Return values
array<string|int, string>|false —getTotalSpace()
Get total space in bytes
public
getTotalSpace() : int|float
Return values
int|float —hasItem()
Test if an item exists.
public
hasItem(string $key) : bool
Parameters
- $key : string
Return values
bool —hasItems()
Test multiple items.
public
hasItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
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
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>
Return values
array<string|int, mixed> —Associative array of keys and new values
optimize()
Optimize the storage
public
optimize() : bool
Return values
bool —removeItem()
Remove an item.
public
removeItem(string $key) : bool
Parameters
- $key : string
Return values
bool —removeItems()
Remove multiple items.
public
removeItems(array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
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
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>
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
Return values
bool —setItems()
Store multiple items.
public
setItems(array<string|int, mixed> $keyValuePairs) : array<string|int, mixed>
Parameters
- $keyValuePairs : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of not stored keys
setOptions()
Set options.
public
setOptions(array<string|int, mixed>|Traversable|AdapterOptions $options) : BlackHole
Parameters
- $options : array<string|int, mixed>|Traversable|AdapterOptions
Return values
BlackHole —Provides a fluent interface
setTags()
Set tags to an item by given key.
public
setTags(string $key, array<string|int, string> $tags) : bool
An empty array will remove all tags.
Parameters
- $key : string
- $tags : array<string|int, string>
Return values
bool —touchItem()
Reset lifetime of an item
public
touchItem(string $key) : bool
Parameters
- $key : string
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>
Return values
array<string|int, mixed> —Array of not updated keys