TaggablePsr6PoolAdapter
This adapter lets you make any PSR-6 cache pool taggable. If a pool is already taggable, it is simply returned by makeTaggable. Tags are stored either in the same cache pool, or a separate pool, and both of these approaches come with different caveats.
A general caveat is that using this adapter reserves any cache key starting with '__tag.'.
Using the same pool is precarious if your cache does LRU evictions of items even if they do not expire (as in e.g. memcached). If so, the tag item may be evicted without all the tagged items having been evicted first, causing items to lose their tags.
In order to mitigate this issue, you may use a separate, more persistent pool for your tag items. Do however note that if you are doing so, the entire pool is reserved for tags, as this pool is cleared whenever the main pool is cleared.
- Full name:
\Qubus\Cache\Psr6\TaggablePsr6PoolAdapter
- This class is marked as final and can't be subclassed
- This class implements:
\Qubus\Cache\Psr6\TaggableCacheItemPool
- This class is a Final class
Properties
cachePool
tagStorePool
Methods
__construct
private __construct(\Psr\Cache\CacheItemPoolInterface $cachePool, ?\Psr\Cache\CacheItemPoolInterface $tagStorePool = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$cachePool | \Psr\Cache\CacheItemPoolInterface | |
$tagStorePool | ?\Psr\Cache\CacheItemPoolInterface |
makeTaggable
public static makeTaggable(\Psr\Cache\CacheItemPoolInterface $cachePool, \Psr\Cache\CacheItemPoolInterface|null $tagStorePool = null): \Qubus\Cache\Psr6\TaggableCacheItemPool
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$cachePool | \Psr\Cache\CacheItemPoolInterface | The pool to which to add tagging capabilities |
$tagStorePool | \Psr\Cache\CacheItemPoolInterface|null | The pool to store tags in. If null is passed, the main pool is used. |
getItem
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$key | mixed |
getItems
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$keys | array |
hasItem
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
clear
{@inheritdoc}
deleteItem
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
deleteItems
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$keys | array |
save
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$item | \Qubus\Cache\Psr6\TaggableCacheItem|\Psr\Cache\CacheItemInterface |
Throws:
saveDeferred
{@inheritdoc}
Parameters:
Parameter | Type | Description |
---|---|---|
$item | \Qubus\Cache\Psr6\TaggableCacheItem|\Psr\Cache\CacheItemInterface |
Throws:
commit
{@inheritdoc}
appendListItem
Parameters:
Parameter | Type | Description |
---|---|---|
$name | mixed | |
$value | mixed |
Throws:
removeList
Parameters:
Parameter | Type | Description |
---|---|---|
$name | mixed |
Throws:
removeListItem
Parameters:
Parameter | Type | Description |
---|---|---|
$name | mixed | |
$key | mixed |
Throws:
getList
Parameters:
Parameter | Type | Description |
---|---|---|
$name | mixed |
Throws:
getTagKey
Parameters:
Parameter | Type | Description |
---|---|---|
$tag | string |
saveTags
Parameters:
Parameter | Type | Description |
---|---|---|
$item | \Qubus\Cache\Psr6\TaggablePsr6ItemAdapter |
Throws:
invalidateTags
Invalidates cached items using tags.
Parameters:
Parameter | Type | Description |
---|---|---|
$tags | array | An array of tags to invalidate |
Return Value:
True on success
invalidateTag
Invalidates cached items using a tag.
Parameters:
Parameter | Type | Description |
---|---|---|
$tag | mixed | The tag to invalidate |
Return Value:
True on success
preRemoveItem
Removes the key form all tag lists.
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
Throws:
removeTagEntries
Parameters:
Parameter | Type | Description |
---|---|---|
$item | \Qubus\Cache\Psr6\TaggableCacheItem |
Throws:
Automatically generated on 2025-10-13