You are here

function KeyvalueMongodb::setMultipleWithExpire in MongoDB 8

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

src/KeyvalueMongodb.php, line 112

Class

KeyvalueMongodb
This class holds a MongoDB key-value backend.

Namespace

Drupal\mongodb

Code

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