Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MongoDbStore.php

function MongoDbStore::exists

Overrides PersistingStoreInterface::exists

File

vendor/symfony/lock/Store/MongoDbStore.php, line 276

Class

MongoDbStore
MongoDbStore is a StoreInterface implementation using MongoDB as a storage engine. Support for MongoDB server >=2.2 due to use of TTL indexes.

Namespace

Symfony\Component\Lock\Store

Code

public function exists(Key $key) : bool {
    $cursor = $this->manager
        ->executeQuery($this->namespace, new Query([
        '_id' => (string) $key,
        'token' => $this->getUniqueToken($key),
        'expires_at' => [
            '$gt' => $this->createMongoDateTime(microtime(true)),
        ],
    ], [
        'limit' => 1,
        'projection' => [
            '_id' => 1,
        ],
    ]));
    return [] !== $cursor->toArray();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal