You are here

function DatabaseStorageExpirable::setMultipleWithExpire in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php \Drupal\Core\KeyValueStore\DatabaseStorageExpirable::setMultipleWithExpire()

Saves an array of values with a time to live.

Parameters

array $data: An array of data to store.

int $expire: The time to live for items, in seconds.

Overrides KeyValueStoreExpirableInterface::setMultipleWithExpire

File

core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php, line 112
Contains \Drupal\Core\KeyValueStore\DatabaseStorageExpirable.

Class

DatabaseStorageExpirable
Defines a default key/value store implementation for expiring items.

Namespace

Drupal\Core\KeyValueStore

Code

function setMultipleWithExpire(array $data, $expire) {
  foreach ($data as $key => $value) {
    $this
      ->setWithExpire($key, $value, $expire);
  }
}