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


PHP Billrun_Factory::cache方法代码示例

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


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

示例1: cleanAccountCache

 /**
  * method to clean account cache
  * 
  * @param int $aid
  * 
  * @return true on success, else false
  */
 protected function cleanAccountCache($aid)
 {
     $cache = Billrun_Factory::cache();
     if (empty($cache)) {
         return false;
     }
     $aids = array_unique(array_diff(Billrun_Util::verify_array(explode(',', $aid), 'int'), array(0)));
     $billrunKey = Billrun_Util::getBillrunKey(time());
     $cachePrefix = 'balance_';
     // this is not the action name because it's clear the balance cache
     foreach ($aids as $aid) {
         $cleanCacheKeys = array(Billrun_Util::generateArrayStamp(array_values(array('aid' => $aid, 'subscribers' => array(), 'stamp' => $billrunKey))), Billrun_Util::generateArrayStamp(array_values(array('aid' => $aid, 'subscribers' => null, 'stamp' => (int) $billrunKey))), Billrun_Util::generateArrayStamp(array_values(array('aid' => $aid, 'subscribers' => "", 'stamp' => (int) $billrunKey))), Billrun_Util::generateArrayStamp(array_values(array('aid' => $aid, 'subscribers' => 0, 'stamp' => (int) $billrunKey))));
         foreach ($cleanCacheKeys as $cacheKey) {
             $cache->remove($cacheKey, $cachePrefix);
         }
     }
     return true;
 }
开发者ID:ngchie,项目名称:system,代码行数:25,代码来源:ResetLines.php

示例2: cache

 /**
  * method to store and fetch by global cache layer
  * 
  * @param type $params params to be used by cache to populate and store
  * 
  * @return mixed the cached results
  */
 protected function cache($params)
 {
     if (!isset($params['stampParams'])) {
         $params['stampParams'] = $params['fetchParams'];
     }
     $cache = Billrun_Factory::cache();
     if (empty($cache)) {
         return $this->fetchData($params['fetchParams']);
     }
     $actionName = $this->getAction();
     $cachePrefix = $this->getCachePrefix();
     $cacheKey = Billrun_Util::generateArrayStamp(array_values($params['stampParams']));
     $cachedData = $cache->get($cacheKey, $cachePrefix);
     if (empty($cachedData)) {
         $cachedData = $this->fetchData($params['fetchParams']);
         $lifetime = Billrun_Factory::config()->getConfigValue('api.cacheLifetime.' . $actionName, $this->getCacheLifeTime());
         $cache->set($cacheKey, $cachedData, $cachePrefix, $lifetime);
     } else {
         Billrun_Factory::log()->log("Fetch data from cache for " . $actionName . " api call", Zend_Log::INFO);
     }
     return $cachedData;
 }
开发者ID:ngchie,项目名称:system,代码行数:29,代码来源:Api.php

示例3: cache

 /**
  * method to retrieve the cache instance
  * 
  * @return Billrun_Cache
  */
 public static function cache()
 {
     try {
         if (!self::$cache) {
             $args = self::config()->getConfigValue('cache', array());
             if (empty($args)) {
                 return false;
             }
             self::$cache = Billrun_Cache::getInstance($args);
         }
         return self::$cache;
     } catch (Exception $e) {
         Billrun_Factory::log('Cache instance cannot be generated', Zend_Log::ALERT);
     }
     return false;
 }
开发者ID:ngchie,项目名称:system,代码行数:21,代码来源:Factory.php

示例4: cache

 /**
  * method to retrieve the cache instance
  * 
  * @return Billrun_Cache
  */
 public static function cache()
 {
     if (!self::$cache) {
         $args = self::config()->getConfigValue('cache', array());
         if (empty($args)) {
             return false;
         }
         self::$cache = Billrun_Cache::getInstance($args);
     }
     return self::$cache;
 }
开发者ID:kalburgimanjunath,项目名称:system,代码行数:16,代码来源:Factory.php


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