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\StoreCode
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();
}