class PhpArrayAdapter implements AdapterInterface, 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, AdapterInterface $fallbackPool)

No description

static CacheItemPoolInterface
create(string $file, CacheItemPoolInterface $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.

getItem($key)

{@inheritdoc}

getItems(array $keys = [])

{@inheritdoc}

hasItem($key)

{@inheritdoc}

deleteItem($key)

{@inheritdoc}

deleteItems(array $keys)

{@inheritdoc}

save(CacheItemInterface $item)

{@inheritdoc}

saveDeferred(CacheItemInterface $item)

{@inheritdoc}

commit()

{@inheritdoc}

static 
throwOnRequiredClass($class)

No description

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 39
__construct(string $file, AdapterInterface $fallbackPool)

Parameters

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

at line 68
static CacheItemPoolInterface create(string $file, CacheItemPoolInterface $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

string $file The PHP file were values are cached
CacheItemPoolInterface $fallbackPool Fallback for old PHP versions or opcache disabled

Return Value

CacheItemPoolInterface

at line 85
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 140
hasItem($key)

{@inheritdoc}

Parameters

$key

at line 155
deleteItem($key)

{@inheritdoc}

Parameters

$key

at line 170
deleteItems(array $keys)

{@inheritdoc}

Parameters

array $keys

at line 200
save(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

at line 212
saveDeferred(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

at line 224
commit()

{@inheritdoc}

at line 271
static throwOnRequiredClass($class)

Parameters

$class

Exceptions

ReflectionException When $class is not found and is required