/** * Deletes data from the store for a given key and releases the lock on it. * * @param string $key * The key of the data to delete. */ public function delete($key) { if (!$this->lockBackend->acquire($key)) { $this->lockBackend->wait($key); if (!$this->lockBackend->acquire($key)) { throw new TempStoreException(String::format("Couldn't acquire lock to delete item %key from %collection temporary storage.", array('%key' => $key, '%collection' => $this->storage->getCollectionName()))); } } $this->storage->delete($key); $this->lockBackend->release($key); }
/** * Deletes data from the store for a given key and releases the lock on it. * * @param string $key * The key of the data to delete. */ public function delete($key) { if (!$this->lockBackend->acquire($key)) { $this->lockBackend->wait($key); if (!$this->lockBackend->acquire($key)) { throw new TempStoreException("Couldn't acquire lock to delete item '{$key}' from {$this->storage->getCollectionName()} temporary storage."); } } $this->storage->delete($key); $this->lockBackend->release($key); }
/** * Deletes data from the store for a given key and releases the lock on it. * * @param string $key * The key of the data to delete. * * @return bool * TRUE if the object was deleted or does not exist, FALSE if it exists but * is not owned by $this->owner. */ public function delete($key) { $key = $this->createkey($key); if (!($object = $this->storage->get($key))) { return TRUE; } elseif ($object->owner != $this->getOwner()) { return FALSE; } if (!$this->lockBackend->acquire($key)) { $this->lockBackend->wait($key); if (!$this->lockBackend->acquire($key)) { throw new TempStoreException("Couldn't acquire lock to delete item '{$key}' from '{$this->storage->getCollectionName()}' temporary storage."); } } $this->storage->delete($key); $this->lockBackend->release($key); return TRUE; }
/** * Deletes data from the store for a given key and releases the lock on it. * * @param string $key * The key of the data to delete. * * @return bool * TRUE if the object was deleted or does not exist, FALSE if it exists but * is not owned by $this->owner. */ public function delete($key) { $key = $this->createkey($key); if (!($object = $this->storage->get($key))) { return TRUE; } elseif ($object->owner != $this->getOwner()) { return FALSE; } if (!$this->lockBackend->acquire($key)) { $this->lockBackend->wait($key); if (!$this->lockBackend->acquire($key)) { throw new TempStoreException(SafeMarkup::format("Couldn't acquire lock to delete item %key from %collection temporary storage.", array('%key' => $key, '%collection' => $this->storage->getCollectionName()))); } } $this->storage->delete($key); $this->lockBackend->release($key); return TRUE; }