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

Breadcrumb

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

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\Store

Code

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;
}

API Navigation

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