Esempio n. 1
0
 /**
  * Deletes the data specified by the key
  *
  * @param string $key   The ket.
  *
  * @throws \YapepBase\Exception\StorageException   If the Storage is read only.
  *
  * @return void
  */
 public function delete($key)
 {
     if ($this->readOnly) {
         throw new StorageException('Trying to write to a read only storage');
     }
     $startTime = microtime(true);
     $fileName = $this->makeFullPath($key);
     try {
         $this->fileHandler->remove($fileName);
     } catch (NotFoundException $e) {
     } catch (FileException $e) {
         throw new StorageException('Unable to remove the file: ' . $fileName, 0, $e);
     }
     $debugger = Application::getInstance()->getDiContainer()->getDebugger();
     if (!$this->debuggerDisabled && $debugger !== false) {
         $debugger->addItem(new StorageItem('file', 'file.' . $this->currentConfigurationName, StorageItem::METHOD_DELETE . ' ' . $key, null, microtime(true) - $startTime));
     }
 }