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
mixed
get(string $key, $default = null)

{@inheritdoc}

public
bool
has(string $key)

{@inheritdoc}

public
bool
delete(string $key)

{@inheritdoc}

public
bool
set(string $key, mixed $value, $ttl = null)

{@inheritdoc}

public
bool
setMultiple(iterable $items, $ttl = null)

{@inheritdoc}

public
iterable
getMultiple(iterable $keys, $default = null)

{@inheritdoc}

public
bool
clear()

{@inheritdoc}

public
bool
deleteMultiple(iterable $keys)

{@inheritdoc}

public
bool
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

mixed get(string $key, $default = null)

{@inheritdoc}

Parameters

string $key
$default

Return Value

mixed

bool has(string $key)

{@inheritdoc}

Parameters

string $key

Return Value

bool

bool delete(string $key)

{@inheritdoc}

Parameters

string $key

Return Value

bool

bool set(string $key, mixed $value, $ttl = null)

{@inheritdoc}

Parameters

string $key
mixed $value
$ttl

Return Value

bool

bool setMultiple(iterable $items, $ttl = null)

{@inheritdoc}

Parameters

iterable $items
$ttl

Return Value

bool

iterable getMultiple(iterable $keys, $default = null)

{@inheritdoc}

Parameters

iterable $keys
$default

Return Value

iterable

bool clear()

{@inheritdoc}

Return Value

bool

bool deleteMultiple(iterable $keys)

{@inheritdoc}

Parameters

iterable $keys

Return Value

bool

bool prune()

{@inheritdoc}

Return Value

bool

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