W3cubDocs

/Drupal 8

class PhpBackend

Defines a PHP cache implementation.

Stores cache items in a PHP file using a storage that implements Drupal\Component\PhpStorage\PhpStorageInterface.

This is fast because of PHP's opcode caching mechanism. Once a file's content is stored in PHP's opcode cache, including it doesn't require reading the contents from a filesystem. Instead, PHP will use the already compiled opcodes stored in memory.

Hierarchy

Related topics

Cache API
Information about the Drupal Cache API

File

core/lib/Drupal/Core/Cache/PhpBackend.php, line 21

Namespace

Drupal\Core\Cache

Members

Name Modifiers Type Description
CacheBackendInterface::CACHE_PERMANENT constant Indicates that the item should never be removed unless explicitly deleted.
PhpBackend::$bin protected property
PhpBackend::$cache protected property Array to store cache objects.
PhpBackend::$checksumProvider protected property The cache tags checksum provider.
PhpBackend::delete public function Deletes an item from the cache. Overrides CacheBackendInterface::delete
PhpBackend::deleteAll public function Deletes all cache items in a bin. Overrides CacheBackendInterface::deleteAll
PhpBackend::deleteMultiple public function Deletes multiple items from the cache. Overrides CacheBackendInterface::deleteMultiple
PhpBackend::garbageCollection public function Performs garbage collection on a cache bin. Overrides CacheBackendInterface::garbageCollection
PhpBackend::get public function Returns data from the persistent cache. Overrides CacheBackendInterface::get
PhpBackend::getByHash protected function Fetch a cache item using a hashed cache ID.
PhpBackend::getMultiple public function Returns data from the persistent cache when given an array of cache IDs. Overrides CacheBackendInterface::getMultiple
PhpBackend::invalidate public function Marks a cache item as invalid. Overrides CacheBackendInterface::invalidate
PhpBackend::invalidateAll public function Marks all cache items as invalid. Overrides CacheBackendInterface::invalidateAll
PhpBackend::invalidatebyHash protected function Invalidate one cache item.
PhpBackend::invalidateMultiple public function Marks cache items as invalid. Overrides CacheBackendInterface::invalidateMultiple
PhpBackend::normalizeCid protected function Ensures a normalized cache ID.
PhpBackend::prepareItem protected function Prepares a cached item.
PhpBackend::removeBin public function Remove a cache bin. Overrides CacheBackendInterface::removeBin
PhpBackend::set public function Stores data in the persistent cache. Overrides CacheBackendInterface::set
PhpBackend::setMultiple public function Store multiple items in the persistent cache. Overrides CacheBackendInterface::setMultiple
PhpBackend::storage protected function Gets the PHP code storage object to use.
PhpBackend::writeItem protected function Writes a cache item to PhpStorage.
PhpBackend::__construct public function Constructs a PhpBackend object.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!PhpBackend.php/class/PhpBackend/8.1.x