You are here

public function Redis_Lock_Backend_Default::getLockId in Redis 7.2

Same name and namespace in other branches
  1. 7 lib/Redis/Lock/Backend/Default.php \Redis_Lock_Backend_Default::getLockId()

Default implementation from actual Drupal core.

Overrides Redis_Lock_Backend_Interface::getLockId

See also

Redis_Lock_Backend_Interface::getLockId()

8 calls to Redis_Lock_Backend_Default::getLockId()
Redis_Lock_Backend_PhpRedis::lockAcquire in lib/Redis/Lock/Backend/PhpRedis.php
Acquire lock.
Redis_Lock_Backend_PhpRedis::lockMayBeAvailable in lib/Redis/Lock/Backend/PhpRedis.php
Check if lock is available for acquire.
Redis_Lock_Backend_PhpRedis::lockRelease in lib/Redis/Lock/Backend/PhpRedis.php
Release given lock.
Redis_Lock_Backend_PhpRedis::lockReleaseAll in lib/Redis/Lock/Backend/PhpRedis.php
Release all locks for the given lock token identifier.
Redis_Lock_Backend_Predis::lockAcquire in lib/Redis/Lock/Backend/Predis.php
Acquire lock.

... See full list

File

lib/Redis/Lock/Backend/Default.php, line 69

Class

Redis_Lock_Backend_Default
Lock backend shared methods.

Code

public function getLockId() {
  if (!isset($this->_lockId)) {
    $this->_lockId = uniqid(mt_rand(), TRUE);

    // We only register a shutdown function if a lock is used.
    drupal_register_shutdown_function('lock_release_all', $this->_lockId);
  }
  return $this->_lockId;
}