class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface

Traits

An implementation of CacheInterface for PSR-6 CacheItemPoolInterface classes.

Methods

prune()

{@inheritdoc}

reset()

{@inheritdoc}

mixed
get(string $key, callable $callback, float $beta = null, array $metadata = null)

Fetches a value from the pool or computes it if not found.

bool
delete(string $key)

{@inheritdoc}

callable
setCallbackWrapper(callable|null $callbackWrapper)

Wraps the callback passed to ->get() in a callable.

__construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0)

No description

getItem($key)

{@inheritdoc}

getItems(array $keys = [])

{@inheritdoc}

hasItem($key)

{@inheritdoc}

clear()

{@inheritdoc}

deleteItem($key)

{@inheritdoc}

deleteItems(array $keys)

{@inheritdoc}

save(CacheItemInterface $item)

{@inheritdoc}

saveDeferred(CacheItemInterface $item)

{@inheritdoc}

commit()

{@inheritdoc}

Details

in ProxyTrait at line 29
prune()

{@inheritdoc}

in ProxyTrait at line 37
reset()

{@inheritdoc}

at line 94
mixed get(string $key, callable $callback, float $beta = null, array $metadata = null)

Fetches a value from the pool or computes it if not found.

On cache misses, a callback is called that should return the missing value. This callback is given a PSR-6 CacheItemInterface instance corresponding to the requested key, that could be used e.g. for expiration control. It could also be an ItemInterface instance when its additional features are needed.

Parameters

string $key The key of the item to retrieve from the cache
callable $callback Should return the computed value for the given key/item
float $beta A float that, as it grows, controls the likeliness of triggering early expiration. 0 disables it, INF forces immediate expiration. The default (or providing null) is implementation dependent but should typically be 1.0, which should provide optimal stampede protection. See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration
array $metadata &$metadata The metadata of the cached item {see ItemInterface::getMetadata()}

Return Value

mixed The value corresponding to the provided key

Exceptions

InvalidArgumentException When $key is not valid or when $beta is negative

in CacheTrait at line 35
bool delete(string $key)

{@inheritdoc}

Parameters

string $key

Return Value

bool

in ContractsTrait at line 40
callable setCallbackWrapper(callable|null $callbackWrapper)

Wraps the callback passed to ->get() in a callable.

Parameters

callable|null $callbackWrapper

Return Value

callable the previous callback wrapper

at line 37
__construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0)

Parameters

CacheItemPoolInterface $pool
string $namespace
int $defaultLifetime

at line 112
CacheItem getItem($key)

{@inheritdoc}

Parameters

$key

Return Value

CacheItem

at line 123
Traversable|CacheItem[] getItems(array $keys = [])

{@inheritdoc}

Parameters

array $keys

Return Value

Traversable|CacheItem[]

at line 137
hasItem($key)

{@inheritdoc}

Parameters

$key

at line 145
clear()

{@inheritdoc}

at line 153
deleteItem($key)

{@inheritdoc}

Parameters

$key

at line 161
deleteItems(array $keys)

{@inheritdoc}

Parameters

array $keys

at line 175
save(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

at line 183
saveDeferred(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

at line 191
commit()

{@inheritdoc}