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


PHP CacheItemInterface::isHit方法代碼示例

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


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

示例1: save

 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  */
 public function save(CacheItemInterface $item)
 {
     if (!$item->isHit()) {
         return false;
     }
     return $this->local->save($item) && $this->remote->save($item);
 }
開發者ID:jmatosp,項目名稱:TumbleweedCache,代碼行數:16,代碼來源:TwoLevelCache.php

示例2: save

 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  */
 public function save(CacheItemInterface $item)
 {
     if (!$item->isHit()) {
         return false;
     }
     $bytes = file_put_contents($this->filenameFor($item->getKey()), serialize($item));
     return false !== $bytes;
 }
開發者ID:jmatosp,項目名稱:TumbleweedCache,代碼行數:17,代碼來源:FileCache.php

示例3: save

 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  */
 public function save(CacheItemInterface $item)
 {
     if (!$item->isHit()) {
         return false;
     }
     $this->stack[$item->getKey()] = $item;
     return true;
 }
開發者ID:jmatosp,項目名稱:TumbleweedCache,代碼行數:17,代碼來源:MemoryCache.php

示例4: save

 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  */
 public function save(CacheItemInterface $item)
 {
     if (!$item->isHit()) {
         return false;
     }
     if ($this->legacy) {
         $store = apc_store($item->getKey(), serialize($item));
     } else {
         $store = apcu_store($item->getKey(), serialize($item));
     }
     return $store;
 }
開發者ID:jmatosp,項目名稱:TumbleweedCache,代碼行數:21,代碼來源:APCuCache.php

示例5: isHit

 public function isHit()
 {
     return $this->decorated->isHit() && $this->isDecryptable();
 }
開發者ID:jeskew,項目名稱:psr6-encrypting-decorator,代碼行數:4,代碼來源:ItemDecorator.php

示例6: save

 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  */
 public function save(CacheItemInterface $item)
 {
     if (!$item->isHit()) {
         return false;
     }
     return $this->cacheClient->add($item->getKey(), serialize($item));
 }
開發者ID:jmatosp,項目名稱:TumbleweedCache,代碼行數:16,代碼來源:MemcachedCache.php

示例7: save

 /**
  * {@inheritdoc}
  */
 public function save(CacheItemInterface $item)
 {
     // This item has no data
     if (!$item->isHit()) {
         return false;
     }
     if ($item instanceof TaggableItemInterface) {
         $key = $item->getTaggedKey();
     } else {
         $key = $item->getKey();
     }
     $timeToLive = null;
     if ($item instanceof HasExpirationDateInterface) {
         if (null !== ($expirationDate = $item->getExpirationDate())) {
             $timeToLive = $expirationDate->getTimestamp() - time();
         }
     }
     return $this->storeItemInCache($key, $item, $timeToLive);
 }
開發者ID:AndrewCarterUK,項目名稱:adapter-common,代碼行數:22,代碼來源:AbstractCachePool.php

示例8: isHit

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


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