You are here

protected function Cache::attemptRemove in MongoDB 7

Attempt removing data from the collection, notifying on exceptions.

Parameters

array|null $criteria: NULL means to remove all documents from the collection.

1 call to Cache::attemptRemove()
Cache::clear in mongodb_cache/mongodb_cache_plugin.php

File

mongodb_cache/mongodb_cache_plugin.php, line 345

Class

Cache
MongoDB cache implementation.

Namespace

Drupal\mongodb_cache

Code

protected function attemptRemove($criteria = NULL) {
  try {
    if ($criteria === []) {
      $this->collection
        ->drop();
    }
    else {
      $this->collection
        ->remove($criteria, $this->unsafe);
    }
  } catch (\MongoException $e) {
    self::notifyException($e);
  }
}