You are here

function lock_release in Memcache API and Integration 6

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

Release a lock previously acquired by lock_acquire().

This will release the named lock if it is still held by the current request.

Parameters

$name: The name of the lock.

3 calls to lock_release()
cache_set in ./memcache.inc
Store data in memcache.
LockFunctionalTest::testLockAcquire in tests/memcache-lock.test
Confirm that we can acquire and release locks in two parallel requests.
memcache_test_lock_acquire in tests/memcache_test.module
Try to acquire a named lock and report the outcome.

File

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

Code

function lock_release($name) {
  global $locks;
  if (dmemcache_get($name, 'semaphore') == $locks[$name]) {
    dmemcache_delete($name, 'semaphore');

    // We unset unconditionally since caller assumes lock is released anyway.
    unset($locks[$name]);
  }
}