You are here

public function DatabaseStorageExpirable::setMultipleWithExpire in Drupal 9

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

Class

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

Namespace

Drupal\Core\KeyValueStore

Code

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