Pool
in package
implements
CacheItemPoolInterface, TaggablePoolInterface
uses
TaggablePoolTrait
PSR-6 & TaggablePoolInterface compliant implementation that wraps over every PSR-6 implementation.
Tags
Table of Contents
Interfaces
- CacheItemPoolInterface
- CacheItemPoolInterface generates CacheItemInterface objects.
- TaggablePoolInterface
Constants
- KEY_INVALID_CHARACTERS = '{}()/\@:'
- List of invalid (or reserved) key characters.
Methods
- __construct() : mixed
- clear() : bool
- Deletes all items in the pool.
- commit() : bool
- Persists any deferred cache items.
- deleteItem() : bool
- Removes the item from the pool.
- deleteItems() : bool
- Removes multiple items from the pool.
- getItem() : Item
- Returns a Cache Item representing the specified key.
- getItems() : array<string|int, Item>
- Returns a traversable set of cache items.
- hasItem() : bool
- Confirms if the cache contains specified cache item.
- save() : bool
- Persists a cache item immediately.
- saveDeferred() : bool
- Sets a cache item to be persisted later.
Constants
KEY_INVALID_CHARACTERS
List of invalid (or reserved) key characters.
public
string
KEY_INVALID_CHARACTERS
= '{}()/\@:'
Methods
__construct()
public
__construct(CacheItemPoolInterface $pool) : mixed
Parameters
- $pool : CacheItemPoolInterface
clear()
Deletes all items in the pool.
public
clear([array<string|int, mixed> $tags = [] ]) : bool
Parameters
- $tags : array<string|int, mixed> = []
Return values
bool —True if the pool was successfully cleared. False if there was an error.
commit()
Persists any deferred cache items.
public
commit() : bool
Return values
bool —True if all not-yet-saved items were successfully saved or there were none. False otherwise.
deleteItem()
Removes the item from the pool.
public
deleteItem(mixed $key[, array<string|int, mixed> $tags = [] ]) : bool
Parameters
- $key : mixed
-
The key to delete.
- $tags : array<string|int, mixed> = []
Return values
bool —True if the item was successfully removed. False if there was an error.
deleteItems()
Removes multiple items from the pool.
public
deleteItems(array<string|int, mixed> $keys[, array<string|int, mixed> $tags = [] ]) : bool
Parameters
- $keys : array<string|int, mixed>
-
An array of keys that should be removed from the pool.
- $tags : array<string|int, mixed> = []
Return values
bool —True if the items were successfully removed. False if there was an error.
getItem()
Returns a Cache Item representing the specified key.
public
getItem(mixed $key[, array<string|int, mixed> $tags = [] ]) : Item
Parameters
- $key : mixed
-
The key for which to return the corresponding Cache Item.
- $tags : array<string|int, mixed> = []
Return values
ItemgetItems()
Returns a traversable set of cache items.
public
getItems([array<string|int, mixed> $keys = [] ][, array<string|int, mixed> $tags = [] ]) : array<string|int, Item>
Parameters
- $keys : array<string|int, mixed> = []
-
An indexed array of keys of items to retrieve.
- $tags : array<string|int, mixed> = []
Return values
array<string|int, Item>hasItem()
Confirms if the cache contains specified cache item.
public
hasItem(mixed $key[, array<string|int, mixed> $tags = [] ]) : bool
Parameters
- $key : mixed
-
The key for which to check existence.
- $tags : array<string|int, mixed> = []
Return values
bool —True if item exists in the cache, false otherwise.
save()
Persists a cache item immediately.
public
save(CacheItemInterface $item) : bool
Parameters
- $item : CacheItemInterface
-
The cache item to save.
Return values
bool —True if the item was successfully persisted. False if there was an error.
saveDeferred()
Sets a cache item to be persisted later.
public
saveDeferred(CacheItemInterface $item) : bool
Parameters
- $item : CacheItemInterface
-
The cache item to save.
Return values
bool —False if the item could not be queued or if a commit was attempted and failed. True otherwise.