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


PHP myCriteria::getCriteriaCacheKey方法代码示例

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


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

示例1: doCountWithCache

 public static function doCountWithCache(Criteria $criteria, $cache_expiry_in_seconds = 600)
 {
     $cache_key = myCriteria::getCriteriaCacheKey($criteria);
     if (!self::$entry_count_cache) {
         self::$entry_count_cache = new myCache("entry_count_cache", $cache_expiry_in_seconds);
     }
     if ($count_result = self::$entry_count_cache->get($cache_key)) {
         KalturaLog::log(__METHOD__ . ": count from cache [{$count_result}] for cacheKey [{$cache_key}]");
         return $count_result;
     } else {
         KalturaLog::log(__METHOD__ . ": NO count from cache [{$count_result}] for cacheKey [{$cache_key}]");
         $count_result = self::doCount($criteria);
         // if we have a count result worth caching - cache it.
         // one the one hand, for few results, it's nice to display rapid differences, therefore cache only if above the MIN_COUNT_RESULT_TO_CACHE threshold
         // one the other hand - it can be that there are very little few resuls (sometimes 0) and still importatn to cache even more than when many results
         // for now - go for the first version - cache above threshold.
         if ($count_result && $count_result > self::MIN_COUNT_RESULT_TO_CACHE) {
             self::$entry_count_cache->put($cache_key, $count_result);
             KalturaLog::log(__METHOD__ . ": Setting count in cache [{$count_result}] for cacheKey [{$cache_key}]");
         } else {
             KalturaLog::log(__METHOD__ . ": Did NOT Set count in cache [{$count_result}] for cacheKey [{$cache_key}]");
         }
     }
     return $count_result;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:25,代码来源:entryPeer.php


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