function PhpBackend::writeItem

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::writeItem()
  2. 8.9.x core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::writeItem()
  3. 10 core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::writeItem()

Writes a cache item to PhpStorage.

Parameters

string $cidhash: The hashed version of the original cache ID after being normalized.

object $item: The cache item to store.

2 calls to PhpBackend::writeItem()
PhpBackend::invalidateByHash in core/lib/Drupal/Core/Cache/PhpBackend.php
Invalidate one cache item.
PhpBackend::set in core/lib/Drupal/Core/Cache/PhpBackend.php
Stores data in the persistent cache.

File

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

Class

PhpBackend
Defines a PHP cache implementation.

Namespace

Drupal\Core\Cache

Code

protected function writeItem($cidhash, \stdClass $item) {
    $content = '<?php return unserialize(' . var_export(serialize($item), TRUE) . ');';
    $this->storage()
        ->save($cidhash, $content);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.