You are here

public static function LockMemcache::unlock in Ultimate Cron 8.2

Release lock.

Parameters

string $lock_id: The lock id to release.

1 call to LockMemcache::unlock()
LockMemcache::shutdown in src/Lock/LockMemcache.php
Shutdown handler for releasing locks.

File

src/Lock/LockMemcache.php, line 87

Class

LockMemcache
Class for handling lock functions.

Namespace

Drupal\ultimate_cron\Lock

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;
}