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


PHP CacheManager::getValueFromCache方法代碼示例

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


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

示例1: getReviewsByProgram

 public function getReviewsByProgram($programid, $limit = 3, $offset = 0)
 {
     $key = 'PROGRAM_REVIEW_LIST_PROD_ID' . $programid . '_LIMIT_' . $limit . '_OFFSET_' . $offset;
     $lists = CacheManager::getValueFromCache($key);
     if ($lists) {
         return $lists;
     }
     $lists = Yii::app()->db->createCommand()->select('id as review_id, comment_title as title, comments ,douban_comment_id as douban_review_id,create_date as create_date ')->from($this->tableName())->where('status=:status and content_id=:prod_id and comment_type=1', array(':status' => Constants::OBJECT_APPROVAL, ':prod_id' => $programid))->order('create_date DESC')->limit($limit)->offset($offset)->queryAll();
     if (count($lists) > 0) {
         $prodExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_POPULAR_PROGRAM);
         CacheManager::setValueToCache($key, $lists, $prodExpired);
     }
     return $lists;
 }
開發者ID:andyongithub,項目名稱:joyplus-cms,代碼行數:14,代碼來源:Comment.php

示例2: listSohuProduce

 public static function listSohuProduce($top_id, $limit, $offset)
 {
     $device = IjoyPlusServiceUtils::getDevice();
     $where = '';
     if ($device === false) {
         $key = SearchManager::CACHE_LIST_ITEMS_BY_TYPE_LIMIT_OFFSET . '_SohuProduce_' . $top_id . '_LIMIT_' . $limit . '_OFFSET_' . $offset;
     } else {
         $where = ' AND (can_search_device like \'%' . $device . '%\' or can_search_device is null or can_search_device =\'\' ) ';
         $key = SearchManager::CACHE_LIST_ITEMS_BY_TYPE_LIMIT_OFFSET . '_SohuProduce_' . $top_id . '_LIMIT_' . $limit . '_OFFSET_' . $offset . '_DEVICE_' . $device;
     }
     if (IjoyPlusServiceUtils::isExcludeCopyMovie()) {
         $where = $where . " and vod.d_area not like '%美國%' ";
     }
     $items = CacheManager::getValueFromCache($key);
     if ($items) {
         return $items;
     }
     $items = Yii::app()->db->createCommand()->select('vod.d_id as prod_id,vod.d_name as prod_name,vod.d_playfrom as sources,vod.d_level as definition, vod.d_type as prod_type,  substring_index( vod.d_pic, \'{Array}\', 1 )  as prod_pic_url, substring_index( vod.d_pic_ipad, \'{Array}\', 1 )  as big_prod_pic_url, vod.d_content as prod_summary,vod.d_starring as star,vod.d_directed as director ,vod.d_score as score,vod.favority_user_count as favority_num ,vod.good_number as support_num ,vod.d_year as publish_date,vod.d_area as area, vod.d_remarks as max_episode, vod.d_state as cur_episode , vod.duraning as duration ')->from('mac_vod_topic_items as items')->join("mac_vod as vod", "items.vod_id=vod.d_id")->where('items.flag=:t_flag and items.topic_id=:topic_id and vod.d_hide=0 ' . $where, array(':t_flag' => 1, ':topic_id' => $top_id))->order('items.disp_order desc, vod.d_level desc ,vod.d_good desc,vod.d_time DESC ')->limit($limit)->offset($offset)->queryAll();
     if (isset($items) && !is_null($items)) {
         $prodExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_POPULAR_PROGRAM);
         CacheManager::setValueToCache($key, $items, $prodExpired);
     }
     return $items;
 }
開發者ID:andyongithub,項目名稱:joyplus-cms,代碼行數:24,代碼來源:SearchManager.php

示例3: getProgramTypeCache

 public static function getProgramTypeCache($prod_type)
 {
     $key = CacheManager::CACHE_PROD_TYPE_BY_PROD_ID . '_' . $prod_type;
     $prodType = CacheManager::getValueFromCache($key);
     if ($prodType) {
         return $prodType;
     }
     $prodType = MacVodType::model()->findByPk($prod_type);
     if (isset($prodType) && !is_null($prodType)) {
         CacheManager::setValueToCache($key, $prodType, 0);
     }
     return $prodType;
 }
開發者ID:andyongithub,項目名稱:joyplus-cms,代碼行數:13,代碼來源:CacheManager.php


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