You are here

public function KeyValueStoreExpirable::setMultipleWithExpire in MongoDB 8.2

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

modules/mongodb_storage/src/KeyValueStoreExpirable.php, line 87

Class

KeyValueStoreExpirable
KeyValueStore provides a KeyValueStoreExpirable as a MongoDB collection.

Namespace

Drupal\mongodb_storage

Code

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