function PhpBackend::set

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

Overrides CacheBackendInterface::set

1 call to PhpBackend::set()
PhpBackend::setMultiple in core/lib/Drupal/Core/Cache/PhpBackend.php
Store multiple items in the persistent cache.

File

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

Class

PhpBackend
Defines a PHP cache implementation.

Namespace

Drupal\Core\Cache

Code

public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = []) {
    assert(Inspector::assertAllStrings($tags), 'Cache Tags must be strings.');
    $item = (object) [
        'cid' => $cid,
        'data' => $data,
        'created' => round(microtime(TRUE), 3),
        'expire' => $expire,
        'tags' => array_unique($tags),
        'checksum' => $this->checksumProvider
            ->getCurrentChecksum($tags),
    ];
    $this->writeItem($this->normalizeCid($cid), $item);
}

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