You are here

public static function UltimateCronLockMemcache::unlock in Ultimate Cron 7.2

Release lock.

Parameters

string $lock_id: The lock id to release.

1 call to UltimateCronLockMemcache::unlock()
UltimateCronLockMemcache::shutdown in ./ultimate_cron.memcache-lock.inc
Shutdown handler for releasing locks.

File

./ultimate_cron.memcache-lock.inc, line 89
A memcached-mediated implementation of a locking mechanism.

Class

UltimateCronLockMemcache
Class for handling lock functions.

Code

public static function unlock($lock_id) {
  if (!preg_match('/(.*):memcache-lock.*/', $lock_id, $matches)) {
    return FALSE;
  }
  $name = $matches[1];
  $result = FALSE;
  if (!($semaphore = self::lock("lock-{$name}"))) {
    return FALSE;
  }
  if (self::isLocked($name) == $lock_id) {
    $result = self::unlockRaw($name);
    unset(self::$locks[$lock_id]);
  }
  else {
    unset(self::$locks[$lock_id]);
  }
  self::unlockRaw("lock-{$name}", $semaphore);
  return $result;
}