You are here

public function MemcacheLockBackend::releaseAll in Memcache API and Integration 8.2

Releases all locks for the given lock token identifier.

Parameters

string $lockId: (optional) If none given, remove all locks from the current page. Defaults to NULL.

Overrides LockBackendInterface::releaseAll

File

src/Lock/MemcacheLockBackend.php, line 110

Class

MemcacheLockBackend
Defines a Memcache lock backend.

Namespace

Drupal\memcache\Lock

Code

public function releaseAll($lock_id = NULL) {
  if (empty($lock_id)) {
    $lock_id = $this
      ->getLockId();
  }
  foreach ($this->locks as $name => $id) {
    $value = $this->memcache
      ->get($name);
    if ($value == $lock_id) {
      $this->memcache
        ->delete($name);
    }
  }
  $this->locks = [];
}