MatthiasMullie\Scrapbook\Buffered\Utils\Transaction::delete PHP Метод

delete() публичный Метод

public delete ( $key )
    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;
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function delete($key)
 {
     $result = $this->transaction->delete($key);
     $this->transaction->commit();
     return $result;
 }