You are here

function _lock_id in Memcache API and Integration 6

Same name and namespace in other branches
  1. 7 memcache-lock-code.inc \_lock_id()

Generate a unique identifier for locks generated during this request.

1 call to _lock_id()
lock_acquire in ./memcache-lock-code.inc
Acquire (or renew) a lock, but do not block if it fails.

File

./memcache-lock-code.inc, line 138
A memcache based implementation of a locking mechanism. See includes/lock.inc for documenation

Code

function _lock_id() {
  static $lock_id;
  if (!isset($lock_id)) {
    $lock_id = uniqid(mt_rand(), TRUE);

    // We only register a shutdown function if a lock is used.
    register_shutdown_function('lock_release_all', $lock_id);
  }
  return $lock_id;
}