function CacheBackendDecorator::setMultiple

Same name and namespace in other branches
  1. 10 core/modules/system/tests/modules/performance_test/src/Cache/CacheBackendDecorator.php \Drupal\performance_test\Cache\CacheBackendDecorator::setMultiple()

Store multiple items in the persistent cache.

Parameters

array $items: An array of cache items, keyed by cid. In the form:

$items = [
  $cid => [
    // Required, will be automatically serialized if not a string.
'data' => $data,
    // Optional, defaults to CacheBackendInterface::CACHE_PERMANENT.
'expire' => CacheBackendInterface::CACHE_PERMANENT,
    // (optional) The cache tags for this item, see CacheBackendInterface::set().
'tags' => [],
  ],
];

Overrides CacheBackendInterface::setMultiple

File

core/modules/system/tests/modules/performance_test/src/Cache/CacheBackendDecorator.php, line 78

Class

CacheBackendDecorator
Wraps an existing cache backend to track calls to the cache backend.

Namespace

Drupal\performance_test\Cache

Code

public function setMultiple(array $items) {
  $cids = array_keys($items);
  $start = microtime(TRUE);
  $this->cacheBackend
    ->setMultiple($items);
  $stop = microtime(TRUE);
  $this->logCacheOperation($cids, $start, $stop, 'setMultiple');
}

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