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

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

public replace ( $key, $value, $expire )
    public function replace($key, $value, $expire = 0)
    {
        // before replacing, make sure the value actually exists (in real cache,
        // or already created in memory)
        if ($this->get($key) === false) {
            return false;
        }
        // store the value in memory, so that when we ask for it again later
        // in this same request, we get the value we just set
        $success = $this->local->set($key, $value, $expire);
        if ($success === false) {
            return false;
        }
        $this->defer->replace($key, $value, $expire);
        return true;
    }

Usage Example

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