You are here

public function Cache::get in MongoDB 7

File

mongodb_cache/mongodb_cache_plugin.php, line 191

Class

Cache
MongoDB cache implementation.

Namespace

Drupal\mongodb_cache

Code

public function get($cid) {
  try {

    // Garbage collection necessary when enforcing a minimum cache lifetime.
    $this
      ->garbageCollection();
    $cache = $this->collection
      ->findOne([
      '_id' => (string) $cid,
    ]);
    $result = $this
      ->prepareItem($cache);
  } catch (\MongoConnectionException $e) {
    self::notifyException($e);
    $result = FALSE;
  }
  return $result;
}