function lock_release in Memcache API and Integration 7
Same name and namespace in other branches
- 6 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
string $name: The name of the lock.
3 calls to lock_release()
- MemCacheDrupal::set in ./
memcache.inc - Implements DrupalCacheInterface::set().
- MemcacheLockFunctionalTest::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 144 - A memcache based implementation of a locking mechanism. See includes/lock.inc for documenation
Code
function lock_release($name) {
global $locks;
if (isset($locks[$name]) && dmemcache_get($name, 'semaphore') == $locks[$name]) {
dmemcache_delete($name, 'semaphore');
// We unset unconditionally since caller assumes lock is released anyway.
unset($locks[$name]);
}
}