As the name says, it is made to be basic and direct.
CacheItemPool generates CacheItemInterface objects.
The primary purpose of Cache\CacheItemPoolInterface is to accept a key from the Calling Library and return the associated Cache\CacheItemInterface object. It is also the primary point of interaction with the entire cache collection. All configuration and initialization of the Pool is left up to an Implementing Library.
Psr\Cache\CacheItemPoolInterface
Name | Description |
---|---|
__construct | Function __construct |
Receives a cacheFile path as param or null | |
addItem | Function addItem |
Adding a chache item | |
checkExpiredItems | Function checkExpiredItems |
Check if items on is hitable and remove | |
clear | Function clear |
Deletes all items in the pool. | |
commit | Function commit |
Persists any deferred cache items. | |
deleteItem | Funtion deleteItem |
Removes the item from the pool. | |
deleteItems | Function deleteItems |
Removes multiple items from the pool. | |
getFile | Function getFile |
Get this pool file path | |
getItem | Function getItem |
Returns a Cache Item representing the specified key. | |
getItems | Function getItems |
Returns a traversable set of cache items. | |
hasItem | Function hasItem |
Confirms if the cache contains specified cache item. | |
load | Function load |
Load a saved cache pool by stream and return this loaded, or return this current object | |
save | Function save |
Persists a cache item immediately. | |
saveDeferred | Function saveDeferred |
Sets a cache item to be persisted later. | |
serialize | Function serialize |
Serialize this pool | |
setFile | Function setFile |
Set this cache pool file | |
unserialize | Function unserialize |
Unserialize this pool | |
withItem | Function withItem |
With a Added chache item |
Description
public __construct (string|null $cacheFile)
Function __construct Receives a cacheFile path as param or null
Parameters
(string|null) $cacheFile
Return Values
void
Description
public addItem (string $key, mixed $value, \DateTimeInterface|null $expiration, int|string|\DateIntervalInterface|null $time)
Function addItem Adding a chache item
Parameters
(string) $key
(mixed) $value
(\DateTimeInterface|null) $expiration
(int|string|\DateIntervalInterface|null) $time
Return Values
void
Description
public checkExpiredItems (void)
Function checkExpiredItems Check if items on is hitable and remove
Parameters
This function has no parameters.
Return Values
\CacheItemPool
Description
public clear (void)
Function clear Deletes all items in the pool.
Parameters
This function has no parameters.
Return Values
bool
True if the pool was successfully cleared. False if there was an error.
Description
public commit (void)
Function commit Persists any deferred cache items.
Parameters
This function has no parameters.
Return Values
bool
True if all not-yet-saved items were successfully saved or there were none. False otherwise.
Description
public deleteItem (string $key)
Funtion deleteItem Removes the item from the pool.
Parameters
(string) $key
Return Values
bool
True if the item was successfully removed. False if there was an error.
Throws Exceptions
\InvalidArgumentException
If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
MUST be thrown.
Description
public deleteItems (string[]|array $keys)
Function deleteItems Removes multiple items from the pool.
Parameters
(string[]|array) $keys
Return Values
bool
True if the items were successfully removed. False if there was an error.
Throws Exceptions
\InvalidArgumentException
If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
MUST be thrown.
Description
public getFile (void)
Function getFile Get this pool file path
Parameters
This function has no parameters.
Return Values
string
Description
public getItem (string $key)
Function getItem Returns a Cache Item representing the specified key.
This method must always return a CacheItemInterface object, even in case of
a cache miss. It MUST NOT return null.
Parameters
(string) $key
Return Values
\CacheItemInterface
The corresponding Cache Item.
Throws Exceptions
\InvalidArgumentException
If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
MUST be thrown.
Description
public getItems (string[] $keys)
Function getItems Returns a traversable set of cache items.
Parameters
(string[]) $keys
Return Values
array|\Traversable
A traversable collection of Cache Items keyed by the cache keys of
each item. A Cache item will be returned for each key, even if that
key is not found. However, if no keys are specified then an empty
traversable MUST be returned instead.
Throws Exceptions
\InvalidArgumentException
If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
MUST be thrown.
Description
public hasItem (string $key)
Function hasItem Confirms if the cache contains specified cache item.
Note: This method MAY avoid retrieving the cached value for performance reasons.
This could result in a race condition with CacheItemInterface::get(). To avoid
such situation use CacheItemInterface::isHit() instead.
Parameters
(string) $key
Return Values
bool
True if item exists in the cache, false otherwise.
Throws Exceptions
\InvalidArgumentException
If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
MUST be thrown.
Description
public load (\CacheItemInterface $item)
Function load Load a saved cache pool by stream and return this loaded, or return this current object
Parameters
(\CacheItemInterface) $item
Return Values
bool
True if the item was successfully persisted. False if there was an error.
Description
public save (\CacheItemInterface $item)
Function save Persists a cache item immediately.
Parameters
(\CacheItemInterface) $item
Return Values
bool
True if the item was successfully persisted. False if there was an error.
Description
public saveDeferred (\CacheItemInterface $item)
Function saveDeferred Sets a cache item to be persisted later.
Parameters
(\CacheItemInterface) $item
Return Values
bool
False if the item could not be queued or if a commit was attempted and failed. True otherwise.
Description
public serialize (void)
Function serialize Serialize this pool
Parameters
This function has no parameters.
Return Values
string
Description
public setFile (void)
Function setFile Set this cache pool file
Parameters
This function has no parameters.
Return Values
string
Description
public unserialize (string $pool)
Function unserialize Unserialize this pool
Parameters
(string) $pool
Return Values
\CacheItemPool
Description
public withItem (string $key, \CacheItemInterface|mixed $value, \DateTimeInterface|null $expiration, int|string|\DateIntervalInterface|null $time)
Function withItem With a Added chache item
Parameters
(string) $key
(\CacheItemInterface|mixed) $value
(\DateTimeInterface|null) $expiration
(int|string|\DateIntervalInterface|null) $time
Return Values
void