本文整理汇总了PHP中CacheManager::getProgramCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager::getProgramCache方法的具体用法?PHP CacheManager::getProgramCache怎么用?PHP CacheManager::getProgramCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager::getProgramCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView()
{
header('Content-type: application/json');
if (!IjoyPlusServiceUtils::validateAPPKey()) {
IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
return;
}
// if(Yii::app()->user->isGuest){
// IjoyPlusServiceUtils::exportServiceError(Constants::SEESION_IS_EXPIRED);
// return ;
// }
$prod_id = Yii::app()->request->getParam("prod_id");
if (!isset($prod_id) || is_null($prod_id)) {
IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
return;
}
$program = CacheManager::getProgramCache($prod_id);
//var_dump($program->can_play_device);
if ($program === null) {
IjoyPlusServiceUtils::exportServiceError(Constants::OBJECT_NOT_FOUND);
return;
}
$prod = ProgramUtil::exportProgramEntity($program);
if (isset($program->can_play_device) && $program->can_play_device !== '0') {
$prod['can_play_device'] = $program->can_play_device;
} else {
$prod['can_play_device'] = '';
}
$comments = Comment::model()->getCommentsByProgram($prod_id, 10, 0);
$commentTemps = array();
if (isset($comments) && is_array($comments)) {
foreach ($comments as $comment) {
$commentTemps[] = IjoyPlusServiceUtils::transferComments($comment);
}
}
$prod['comments'] = $commentTemps;
$topics = Topic::model()->getRelatedTops($prod_id);
if (isset($topics) && is_array($topics)) {
$prod['topics'] = $topics;
} else {
$prod['topics'] = array();
}
IjoyPlusServiceUtils::exportEntity($prod);
}
示例2: getProgramVOByID
public static function getProgramVOByID($prod_id)
{
$key = CacheManager::CACHE_PROGRAM_VO_BY_ID . '_' . $prod_id;
$prodVO = CacheManager::getValueFromCache($key);
if ($prodVO) {
return $prodVO;
}
$prod = CacheManager::getProgramCache($prod_id);
$prodVO = new ProgramVO();
if (isset($prod) && !is_null($prod)) {
$prodVO->id = $prod->d_id;
$prodVO->pro_type = $prod->d_type;
$prodVO->name = $prod->d_name;
$prodVO->poster = $prod->d_pic;
$prodVO->score = $prod->d_score;
$prodVO->publish_owner_id = $prod->publish_owner_id;
$userExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_PROGRAM);
CacheManager::setValueToCache($key, $prodVO, $userExpired);
return $prodVO;
} else {
return null;
}
}