function DoctrineDbalPostgreSqlStore::exists
Overrides PersistingStoreInterface::exists
2 calls to DoctrineDbalPostgreSqlStore::exists()
- DoctrineDbalPostgreSqlStore::delete in vendor/
symfony/ lock/ Store/ DoctrineDbalPostgreSqlStore.php - Removes a resource from the storage.
- DoctrineDbalPostgreSqlStore::putOffExpiration in vendor/
symfony/ lock/ Store/ DoctrineDbalPostgreSqlStore.php - Extends the TTL of a resource.
File
-
vendor/
symfony/ lock/ Store/ DoctrineDbalPostgreSqlStore.php, line 169
Class
- DoctrineDbalPostgreSqlStore
- DoctrineDbalPostgreSqlStore is a PersistingStoreInterface implementation using PostgreSql advisory locks with a Doctrine DBAL Connection.
Namespace
Symfony\Component\Lock\StoreCode
public function exists(Key $key) : bool {
$sql = "SELECT count(*) FROM pg_locks WHERE locktype='advisory' AND objid=:key AND pid=pg_backend_pid()";
$result = $this->conn
->executeQuery($sql, [
'key' => $this->getHashedKey($key),
]);
if ($result->fetchOne() > 0) {
// connection is locked, check for lock in internal store
return $this->getInternalStore()
->exists($key);
}
return false;
}