delete() public method

public delete ( string $key )
$key string
Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function delete($key)
 {
     // check the current value to see if it currently exists, so we can
     // properly return true/false as would be expected from KeyValueStore
     $value = $this->get($key);
     if ($value === false) {
         return false;
     }
     /*
      * To make sure that subsequent get() calls for this key don't return
      * a value (it's supposed to be deleted), we'll make it expired in our
      * temporary bag (as opposed to deleting it from out bag, in which case
      * we'd fall back to fetching it from real store, where the transaction
      * might not yet be committed)
      */
     $this->local->set($key, $value, -1);
     $this->defer->delete($key);
     return true;
 }