当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Cache_Backend::load方法代码示例

本文整理汇总了PHP中Zend_Cache_Backend::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Backend::load方法的具体用法?PHP Zend_Cache_Backend::load怎么用?PHP Zend_Cache_Backend::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Cache_Backend的用法示例。


在下文中一共展示了Zend_Cache_Backend::load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Test if a cache is available for the given id and (if yes) return it (false else)
  *
  * Note : return value is always "string" (unserialization is done by the core not by the backend)
  *
  * @param  string  $id                     Cache id
  * @param  boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
  * @return string|false cached datas
  */
 public function load($id, $doNotTestCacheValidity = false)
 {
     self::_validateIdOrTag($id);
     $res = $this->_fastBackend->load($id, $doNotTestCacheValidity);
     if ($res === false) {
         $res = $this->_slowBackend->load($id, $doNotTestCacheValidity);
         if ($res === false) {
             // there is no cache at all for this id
             return false;
         }
     }
     $array = unserialize($res);
     // maybe, we have to refresh the fast cache ?
     if ($this->_options['auto_refresh_fast_cache']) {
         if ($array['priority'] == 10) {
             // no need to refresh the fast cache with priority = 10
             return $array['data'];
         }
         $newFastLifetime = $this->_getFastLifetime($array['lifetime'], $array['priority'], time() - $array['expire']);
         // we have the time to refresh the fast cache
         $usage = $this->_getFastFillingPercentage('loading');
         if ($array['priority'] > 0 && 10 * $array['priority'] >= $usage) {
             // we can refresh the fast cache
             $preparedData = $this->_prepareData($array['data'], $array['lifetime'], $array['priority']);
             $this->_fastBackend->save($preparedData, $id, array(), $newFastLifetime);
         }
     }
     return $array['data'];
 }
开发者ID:padraic,项目名称:zfcache,代码行数:38,代码来源:TwoLevels.php

示例2: multiGet

 /**
  * Поддержка мульти-запросов к кешу
  * Такие запросы поддерживает только memcached, поэтому для остальных типов делаем эмуляцию
  *
  * @param  array $aName Имя ключа
  * @return bool|array
  */
 public function multiGet($aName)
 {
     if (count($aName) == 0) {
         return false;
     }
     if ($this->sCacheType == SYS_CACHE_TYPE_MEMORY) {
         $aKeys = array();
         $aKv = array();
         foreach ($aName as $sName) {
             $aKeys[] = md5(Config::Get('sys.cache.prefix') . $sName);
             $aKv[md5(Config::Get('sys.cache.prefix') . $sName)] = $sName;
         }
         $data = $this->oBackendCache->load($aKeys);
         if ($data and is_array($data)) {
             $aData = array();
             foreach ($data as $key => $value) {
                 $aData[$aKv[$key]] = $value;
             }
             if (count($aData) > 0) {
                 return $aData;
             }
         }
         return false;
     } else {
         $aData = array();
         foreach ($aName as $key => $sName) {
             if (false !== ($data = $this->Get($sName))) {
                 $aData[$sName] = $data;
             }
         }
         if (count($aData) > 0) {
             return $aData;
         }
         return false;
     }
 }
开发者ID:lunavod,项目名称:bunker_stable,代码行数:43,代码来源:Cache.class.php

示例3: load

 /**
  * Test if a cache is available for the given id and (if yes) return it (false else)
  *
  * Note : return value is always "string" (unserialization is done by the core not by the backend)
  *
  * @param  string  $cacheId                     Cache id
  * @param  boolean $noTestCacheValidity If set to true, the cache validity won't be tested
  * @return string|false cached datas
  */
 public function load($cacheId, $noTestCacheValidity = false)
 {
     return $this->_backend->load($cacheId, $noTestCacheValidity);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:AbstractDecorator.php


注:本文中的Zend_Cache_Backend::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。