PhpArrayAdapter

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

PhpArrayTrait
ProxyTrait

Methods

prune()

{@inheritdoc}

from ProxyTrait
reset()

{@inheritdoc}

from ProxyTrait
warmUp(array $values)

Store an array of cached values.

from PhpArrayTrait
clear()

{@inheritdoc}

from PhpArrayTrait
__construct(string $file, AdapterInterface $fallbackPool)
static CacheItemPoolInterface create(string $file, CacheItemPoolInterface $fallbackPool)

This adapter takes advantage of how PHP stores arrays in its latest versions.

CacheItem getItem($key)

{@inheritdoc}

getItems(array $keys = array())

{@inheritdoc}

hasItem($key)

{@inheritdoc}

deleteItem($key)

{@inheritdoc}

deleteItems(array $keys)

{@inheritdoc}

save(CacheItemInterface $item)

{@inheritdoc}

saveDeferred(CacheItemInterface $item)

{@inheritdoc}

commit()

{@inheritdoc}

static throwOnRequiredClass($class)

Details

prune()

{@inheritdoc}

reset()

{@inheritdoc}

warmUp(array $values)

Store an array of cached values.

Parameters

array $values The cached values

clear()

{@inheritdoc}

__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

static CacheItemPoolInterface create(string $file, CacheItemPoolInterface $fallbackPool)

This adapter takes advantage of how PHP stores arrays in its latest versions.

Parameters

string $file The PHP file were values are cached
CacheItemPoolInterface $fallbackPool Fallback when opcache is disabled

Return Value

CacheItemPoolInterface

CacheItem getItem($key)

{@inheritdoc}

Parameters

$key

Return Value

CacheItem

getItems(array $keys = array())

{@inheritdoc}

return \Traversable|CacheItem[]

Parameters

array $keys

hasItem($key)

{@inheritdoc}

Parameters

$key

deleteItem($key)

{@inheritdoc}

Parameters

$key

deleteItems(array $keys)

{@inheritdoc}

Parameters

array $keys

save(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

saveDeferred(CacheItemInterface $item)

{@inheritdoc}

Parameters

CacheItemInterface $item

commit()

{@inheritdoc}

static throwOnRequiredClass($class)

Parameters

$class

Exceptions

ReflectionException When $class is not found and is required

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Cache/Adapter/PhpArrayAdapter.html