public function getExpressionDetailByEmotion($emotion) { $cache_id = "_model_expression"; if (($list = object_cache_get($cache_id)) === false) { $res = $this->getAllExpression(); $list = $res; object_cache_set($cache_id, $list); } return $list[$emotion]; }
/** * 获取所有的"用户-用户组"关联关系 * * 本方法按照运行时缓存->文件缓存->数据库的顺序查询 * @param $do_format 是否将结果集格式化为array($uid => $user_group_link) */ public function getAllUserGroupLink($do_format = true) { $cache_id = '_model_user_group_link' . ($do_format ? '_1' : '_0'); if (($res = object_cache_get($cache_id)) === false) { if (($res = F($cache_id)) === false) { $temp = M('user_group_link')->findAll(); if ($do_format) { foreach ($temp as $v) { $res[$v['uid']][] = $v; } } else { $res = $temp; } unset($temp); F($cache_id, $res); } object_cache_set($cache_id, $res); } return $res; }
public function _getWeiboCache($id) { $res = object_cache_get("weibo_" . $id); return $res == false ? F('weibo_detail_' . $id) : $res; }
public function getCommentDetail($comment_id) { $cache_id = 'weibo_comment_' . $comment_id; if (($res = object_cache_get($cache_id)) === false) { $res = $this->where("`comment_id` = '{$comment_id}' AND `isdel` = 0")->find(); object_cache_set($cache_id, $res); } return $res; }
public function getUserTagList($uid) { $base_cache_id = 'user_tag_'; if (($res = object_cache_get($base_cache_id . $uid)) === false) { $this->setUserTagObjectCache(array($uid)); $res = object_cache_get($base_cache_id . $uid); } return $res; }
return false; } $base_cache_id = 'user_following_count_'; $uids = implode(',', $uids); $sql = "SELECT count(*) AS `count`, `uid` FROM {$this->tablePrefix}weibo_follow WHERE `uid` IN ( {$uids} ) AND `type` = 0 GROUP BY `uid`"; $res = M('weibo_follow')->query($sql); foreach ($res as $v) { object_cache_set($base_cache_id . $v['uid'], $v['count']); }