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

Breadcrumb

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

function PostgreSqlStore::exists

Overrides PersistingStoreInterface::exists

2 calls to PostgreSqlStore::exists()
PostgreSqlStore::delete in vendor/symfony/lock/Store/PostgreSqlStore.php
Removes a resource from the storage.
PostgreSqlStore::putOffExpiration in vendor/symfony/lock/Store/PostgreSqlStore.php
Extends the TTL of a resource.

File

vendor/symfony/lock/Store/PostgreSqlStore.php, line 166

Class

PostgreSqlStore
PostgreSqlStore is a PersistingStoreInterface implementation using PostgreSql advisory locks.

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()";
    $stmt = $this->getConnection()
        ->prepare($sql);
    $stmt->bindValue(':key', $this->getHashedKey($key));
    $stmt->execute();
    if ($stmt->fetchColumn() > 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