You are here

function DatabaseStorageExpirable::setMultipleWithExpire in Service Container 7

Same name and namespace in other branches
  1. 7.2 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

lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php, line 132
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);
  }
}