You are here

function _apdqc_lock_wait in Asynchronous Prefetch Database Query Cache 7

Same name in this branch
  1. 7 apdqc.lock.apc.inc \_apdqc_lock_wait()
  2. 7 apdqc.lock.db.inc \_apdqc_lock_wait()
  3. 7 apdqc.lock.memcache_storage.inc \_apdqc_lock_wait()
  4. 7 apdqc.lock.memcache.inc \_apdqc_lock_wait()
  5. 7 apdqc.lock.redis.inc \_apdqc_lock_wait()

Wait for a lock to be available.

This function may be called in a request that fails to acquire a desired lock. This will block further execution until the lock is available or the specified delay in seconds is reached. This should not be used with locks that are acquired very frequently, since the lock is likely to be acquired again by a different request while waiting.

Parameters

string $name: The name of the lock.

int $delay: The maximum number of seconds to wait, as an integer.

Return value

bool TRUE if the lock holds, FALSE if it is available.

1 call to _apdqc_lock_wait()
apdqc.lock.inc in ./apdqc.lock.inc
A database-mediated implementation of a locking mechanism.
1 string reference to '_apdqc_lock_wait'
apdqc.lock.inc in ./apdqc.lock.inc
A database-mediated implementation of a locking mechanism.

File

./apdqc.lock.redis.inc, line 73
Drupal core lock.inc replacement.

Code

function _apdqc_lock_wait($name, $delay = 30) {
  return Redis_Lock::getBackend()
    ->lockWait($name, $delay);
}