You are here

public function CacheBackendMongodb::invalidateMultiple in MongoDB 8

Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple().

Marks cache items as invalid. Invalid items may be returned in later calls to get(), if the $allow_invalid argument is TRUE.

Parameters

string $cids: An array of cache IDs to invalidate.

Overrides CacheBackendInterface::invalidateMultiple

1 call to CacheBackendMongodb::invalidateMultiple()
CacheBackendMongodb::invalidate in src/CacheBackendMongodb.php
Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().

File

src/CacheBackendMongodb.php, line 300
Definition of Drupal\mongodb/CacheBackendMongodb.

Class

CacheBackendMongodb
Defines MongoDB cache implementation.

Namespace

Drupal\mongodb

Code

public function invalidateMultiple(array $cids) {
  try {
    $this->collection
      ->update(array(
      '_id' => array(
        '$in' => array_map('strval', $cids),
      ),
    ), array(
      '$set' => array(
        'expire' => new \MongoDate(REQUEST_TIME - 1),
      ),
    ), array(
      'w' => 0,
      'multiple' => TRUE,
    ));
  } catch (\Exception $e) {

    // The database may not be available.
  }
}