abstract class ProxyCacheAdapter implements CacheInterface, ResettableInterface, PruneableInterface (View source)

psr-6 cache proxy for an internal cache, which provides segmentation of cache keys based on current versioned mode. This ensures that cross-stage content cannot cross-pollenate each other.

Note: segmentation can be disabled via 'versionedstate = false' being supplied as a constructor arg.

Based on Symfony\Component\Cache\Simple\TraceableCache

Properties

protected CacheInterface $pool

Methods

public
__construct(CacheInterface $pool)

Create container cache controlling an inner pool cache

public
array
__sleep()

Do not serialize() $this->pool because it may contain a non-serializable cache.

public
get($key, $default = null)

{@inheritdoc}

public
has($key)

{@inheritdoc}

public
delete($key)

{@inheritdoc}

public
set($key, $value, $ttl = null)

{@inheritdoc}

public
setMultiple($items, $ttl = null)

{@inheritdoc}

public
getMultiple($keys, $default = null)

{@inheritdoc}

public
clear()

{@inheritdoc}

public
deleteMultiple($keys)

{@inheritdoc}

public
prune()

{@inheritdoc}

public
reset()

{@inheritdoc}

protected
string
getKeyID(string $key)

Map user cache to internal cache

protected
array
getKeyIDs(iterable $keys)

Get key ids

protected
array
iteratorToArray(iterable $keys)

Ensure that a list is cast to an array

Details

__construct(CacheInterface $pool)

Create container cache controlling an inner pool cache

Parameters

CacheInterface $pool

array __sleep()

Do not serialize() $this->pool because it may contain a non-serializable cache.

For instance, Symfony\Component\Cache\Simple\FilesystemCache cannot be serialized because in will throw an exception in Symfony\Component\Cache\Traits\FilesystemCommonTrait::__sleep()

Return Value

array

get($key, $default = null)

{@inheritdoc}

Parameters

$key
$default

has($key)

{@inheritdoc}

Parameters

$key

delete($key)

{@inheritdoc}

Parameters

$key

set($key, $value, $ttl = null)

{@inheritdoc}

Parameters

$key
$value
$ttl

setMultiple($items, $ttl = null)

{@inheritdoc}

Parameters

$items
$ttl

getMultiple($keys, $default = null)

{@inheritdoc}

Parameters

$keys
$default

clear()

{@inheritdoc}

deleteMultiple($keys)

{@inheritdoc}

Parameters

$keys

prune()

{@inheritdoc}

reset()

{@inheritdoc}

abstract protected string getKeyID(string $key)

Map user cache to internal cache

Parameters

string $key

Return Value

string

protected array getKeyIDs(iterable $keys)

Get key ids

Parameters

iterable $keys

Return Value

array

Array where keys are passed in $keys, and values are key IDs

protected array iteratorToArray(iterable $keys)

Ensure that a list is cast to an array

Parameters

iterable $keys

Return Value

array