class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInterface

Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0.

Warmed up items are read-only and run-time discovered items are cached using a fallback adapter.

Traits

Methods

prune()

{@inheritdoc}

reset()

{@inheritdoc}

warmUp(array $values)

Store an array of cached values.

clear()

{@inheritdoc}

__construct(string $file, CacheInterface $fallbackPool)

No description

static CacheInterface
create($file, CacheInterface $fallbackPool)

This adapter should only be used on PHP 7.0+ to take advantage of how PHP stores arrays in its latest versions. This factory method decorates the given fallback pool with this adapter only if the current PHP version is supported.

get($key, $default = null)

{@inheritdoc}

getMultiple($keys, $default = null)

{@inheritdoc}

has($key)

{@inheritdoc}

delete($key)

{@inheritdoc}

deleteMultiple($keys)

{@inheritdoc}

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

{@inheritdoc}

setMultiple($values, $ttl = null)

{@inheritdoc}

Details

in ProxyTrait at line 29
prune()

{@inheritdoc}

in ProxyTrait at line 37
reset()

{@inheritdoc}

in PhpArrayTrait at line 36
warmUp(array $values)

Store an array of cached values.

Parameters

array $values The cached values

in PhpArrayTrait at line 117
clear()

{@inheritdoc}

at line 35
__construct(string $file, CacheInterface $fallbackPool)

Parameters

string $file The PHP file were values are cached
CacheInterface $fallbackPool A pool to fallback on when an item is not hit

at line 51
static CacheInterface create($file, CacheInterface $fallbackPool)

This adapter should only be used on PHP 7.0+ to take advantage of how PHP stores arrays in its latest versions. This factory method decorates the given fallback pool with this adapter only if the current PHP version is supported.

Parameters

$file
CacheInterface $fallbackPool

Return Value

CacheInterface

at line 64
get($key, $default = null)

{@inheritdoc}

Parameters

$key
$default

at line 98
getMultiple($keys, $default = null)

{@inheritdoc}

Parameters

$keys
$default

at line 120
has($key)

{@inheritdoc}

Parameters

$key

at line 135
delete($key)

{@inheritdoc}

Parameters

$key

at line 150
deleteMultiple($keys)

{@inheritdoc}

Parameters

$keys

at line 184
set($key, $value, $ttl = null)

{@inheritdoc}

Parameters

$key
$value
$ttl

at line 199
setMultiple($values, $ttl = null)

{@inheritdoc}

Parameters

$values
$ttl