function TempStore::delete

Deletes data from the store for a given key and releases the lock on it.

Parameters

string $key: The key of the data to delete.

File

drupal/core/modules/user/lib/Drupal/user/TempStore.php, line 183
Contains Drupal\user\TempStore.

Class

TempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\user

Code

function delete($key) {
  if (!$this->lockBackend
    ->acquire($key)) {
    $this->lockBackend
      ->wait($key);
    if (!$this->lockBackend
      ->acquire($key)) {
      throw new TempStoreException(format_string("Couldn't acquire lock to delete item %key from %collection temporary storage.", array(
        '%key' => $key,
        '%collection' => $this->storage->collection,
      )));
    }
  }
  $this->storage
    ->delete($key);
  $this->lockBackend
    ->release($key);
}