You are here

protected function PhpBackend::writeItem in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::writeItem()
  2. 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 243

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);
}