當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CacheItemInterface::set方法代碼示例

本文整理匯總了PHP中Psr\Cache\CacheItemInterface::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheItemInterface::set方法的具體用法?PHP CacheItemInterface::set怎麽用?PHP CacheItemInterface::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Psr\Cache\CacheItemInterface的用法示例。


在下文中一共展示了CacheItemInterface::set方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: finalize

 public function finalize()
 {
     $this->decorated->set((string) $this->iron->encrypt($this->password, json_encode($this->plaintext), $this->expiration ? time() - $this->expiration : 0));
 }
開發者ID:jeskew,項目名稱:psr6-encrypting-decorator,代碼行數:4,代碼來源:ItemDecorator.php

示例2: generateNewTagId

 /**
  * 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;
 }
開發者ID:matthiasmullie,項目名稱:taggable-cache,代碼行數:18,代碼來源:TaggablePoolTrait.php

示例3: cache

 /**
  * 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;
 }
開發者ID:subins2000,項目名稱:lobby-site-compressor,代碼行數:12,代碼來源:min-css.php

示例4: handleSuccessfulResponse

 /**
  * @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());
     }
 }
開發者ID:pwnraid,項目名稱:bnet,代碼行數:25,代碼來源:AbstractClient.php

示例5: getObjectByKey

 /**
  * @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]);
     }
 }
開發者ID:mobly,項目名稱:aerospike-psr7,代碼行數:12,代碼來源:AerospikeAdapter.php

示例6: set

 public function set($value)
 {
     $this->decorated->set($this->encrypt($value));
     $this->decrypted = $value;
     return $this;
 }
開發者ID:jeskew,項目名稱:psr6-encrypting-decorator,代碼行數:6,代碼來源:ItemDecorator.php

示例7: generateNewTagId

 /**
  * 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;
 }
開發者ID:aequasi,項目名稱:taggable-cache,代碼行數:16,代碼來源:TaggablePoolTrait.php

示例8: set

 /**
  * {@inheritdoc}
  */
 public function set($value)
 {
     $this->item->set($value);
     return $this;
 }
開發者ID:sternt,項目名稱:scrapbook,代碼行數:8,代碼來源:Item.php


注:本文中的Psr\Cache\CacheItemInterface::set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。