/** * {@inheritdoc} */ 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; }