You are here

function _apdqc_lock_acquire in Asynchronous Prefetch Database Query Cache 7

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

Acquire (or renew) a lock, but do not block if it fails.

Parameters

string $name: The name of the lock.

int $timeout: A number of seconds (int) before the lock expires (minimum of 1).

Return value

bool TRUE if the lock was acquired, FALSE if it failed.

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

File

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

Code

function _apdqc_lock_acquire($name, $timeout = 30.0) {
  return Redis_Lock::getBackend()
    ->lockAcquire($name, $timeout);
}