You are here

public function Redis_Lock_PhpRedis::lockMayBeAvailable in Redis 7.3

Check if lock is available for acquire.

Parameters

string $name: Lock to acquire.

Return value

bool

Overrides Redis_Lock_BackendInterface::lockMayBeAvailable

File

lib/Redis/Lock/PhpRedis.php, line 87

Class

Redis_Lock_PhpRedis
Predis lock backend implementation.

Code

public function lockMayBeAvailable($name) {
  $client = $this
    ->getClient();
  $key = $this
    ->getKey($name);
  $id = $this
    ->getLockId();
  $value = $client
    ->get($key);
  return FALSE === $value || $id == $value;
}