コード例 #1
0
 public function finalize()
 {
     $this->decorated->set((string) $this->iron->encrypt($this->password, json_encode($this->plaintext), $this->expiration ? time() - $this->expiration : 0));
 }
コード例 #2
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;
 }
コード例 #3
0
 /**
  * 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;
 }
コード例 #4
0
ファイル: AbstractClient.php プロジェクト: pwnraid/bnet
 /**
  * @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());
     }
 }
コード例 #5
0
 /**
  * @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]);
     }
 }
コード例 #6
0
 public function set($value)
 {
     $this->decorated->set($this->encrypt($value));
     $this->decrypted = $value;
     return $this;
 }
コード例 #7
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);
     return $value;
 }
コード例 #8
0
ファイル: Item.php プロジェクト: sternt/scrapbook
 /**
  * {@inheritdoc}
  */
 public function set($value)
 {
     $this->item->set($value);
     return $this;
 }