public function finalize() { $this->decorated->set((string) $this->iron->encrypt($this->password, json_encode($this->plaintext), $this->expiration ? time() - $this->expiration : 0)); }
/** * A TagId is retrieved from cache using the TagKey. * * @param \Psr\Cache\CacheItemPoolInterface $storage * @param CacheItemInterface $item * * @return string */ private function generateNewTagId(CacheItemInterface $item) { $value = str_replace('.', '', uniqid('', true)); $item->set($value); $item->expiresAfter(null); $this->save($item); // Save to temporary tag store $this->tags[$item->getKey()] = $value; return $value; }
/** * Minify the data & write it to a CacheItemInterface object. * * @param CacheItemInterface $item Cache item to write the data to. * @return CacheItemInterface Cache item with the minifier data. */ public function cache(CacheItemInterface $item) { $content = $this->execute(); $item->set($content); return $item; }
/** * @param ResponseInterface $response * @param CacheItemInterface $item * @param array|null $data * * @throws \RuntimeException * * @return array */ protected function handleSuccessfulResponse(ResponseInterface $response, CacheItemInterface $item = null) { switch ((int) $response->getStatusCode()) { case 200: $data = json_decode($response->getBody(), true); if ($item !== null && $response->hasHeader('Last-Modified') === true) { $item->set(['modified' => $response->getHeader('Last-Modified'), 'json' => $data]); $this->cache->save($item); } return $data; case 304: return $item->get()['json']; default: throw new \RuntimeException('No support added for HTTP Status Code ' . $response->getStatusCode()); } }
/** * @param CacheItemInterface $cacheItem * @param $key */ protected function getObjectByKey(CacheItemInterface $cacheItem, $key) { $transformedKey = $this->transformKey($key); $status = $this->cache->get($transformedKey, $record); if ($status == \Aerospike::OK) { $cacheItem->set($record['bins'][self::AEROSPIKE_BIN]); } }
public function set($value) { $this->decorated->set($this->encrypt($value)); $this->decrypted = $value; return $this; }
/** * A TagId is retrieved from cache using the TagKey. * * @param \Psr\Cache\CacheItemPoolInterface $storage * @param CacheItemInterface $item * * @return string */ private function generateNewTagId(CacheItemInterface $item) { $value = str_replace('.', '', uniqid('', true)); $item->set($value); $item->expiresAfter(null); $this->save($item); return $value; }
/** * {@inheritdoc} */ public function set($value) { $this->item->set($value); return $this; }