You are here

protected function ChainedStorageTrait::KeyValueToCache in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/KeyValueStore/ChainedStorageTrait.php \Drupal\supercache\KeyValueStore\ChainedStorageTrait::KeyValueToCache()

Converts an array of KeyValues to a cache compatible array.

Parameters

array $items: Key/Value pair items to store.

array $items: Expiration times for the items.

Return value

array

3 calls to ChainedStorageTrait::KeyValueToCache()
ChainedStorage::getMultiple in src/KeyValueStore/ChainedStorage.php
Returns the stored key/value pairs for a given set of keys.
ChainedStorageExpirable::getMultiple in src/KeyValueStore/ChainedStorageExpirable.php
Returns the stored key/value pairs for a given set of keys.
ChainedStorageTrait::populateMissingValuesLocal in src/KeyValueStore/ChainedStorageTrait.php
To prevent database lookups we store a special 'empty' object.

File

src/KeyValueStore/ChainedStorageTrait.php, line 64

Class

ChainedStorageTrait

Namespace

Drupal\supercache\KeyValueStore

Code

protected function KeyValueToCache(array $items, array $expirations = []) {
  $result = array();
  foreach ($items as $key => $value) {
    $result[$key] = array(
      'data' => $value,
      'expire' => isset($expirations[$key]) ? $expirations[$key] : CacheBackendInterface::CACHE_PERMANENT,
      'tags' => array(),
    );
  }
  return $result;
}