本文整理汇总了PHP中Perf::gatherCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Perf::gatherCache方法的具体用法?PHP Perf::gatherCache怎么用?PHP Perf::gatherCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Perf
的用法示例。
在下文中一共展示了Perf::gatherCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSendToUsernames
function getSendToUsernames($type, $tid)
{
global $windid, $db;
$usernames = array();
if (!$type || !$tid) {
return $usernames;
}
$remindUsernames = $db->get_value("SELECT db_value FROM pw_config WHERE db_name = 'report_remind'");
$remindUsernames = $remindUsernames ? unserialize($remindUsernames) : array();
foreach ($remindUsernames as $key => $value) {
if ($value['username'] == $windid) {
continue;
}
$usernames[] = $value['username'];
}
if ($type != 'topic') {
return $usernames;
}
$_cacheService = Perf::gatherCache('pw_threads');
$threads = $_cacheService->getThreadByThreadId($tid);
$fid = $threads['fid'];
L::loadClass('forum', 'forum', false);
$forumService = new PwForum($fid);
$foruminfo = $forumService->foruminfo;
$forumadmins = $foruminfo['forumadmin'];
$forumadmins = explode(',', $forumadmins);
foreach ($forumadmins as $forumadmin) {
if (!$forumadmin || $forumadmin == $windid) {
continue;
}
$usernames[] = $forumadmin;
}
return $usernames;
}
示例2: _getThreadData
function _getThreadData($tid)
{
//* $threadService = L::loadClass('threads','forum');
//* return $threadService->getThreads($tid, true);
$_cacheService = Perf::gatherCache('pw_threads');
return $_cacheService->getThreadAndTmsgByThreadId($tid);
}
示例3: clearCacheByName
function clearCacheByName($tableName, $fields)
{
if (!isset($fields['name'])) {
return false;
}
$cache = Perf::gatherCache('PW_Cache');
$cache->clearCacheByName($fields['name']);
}
示例4: clearCacheForSpaceByUid
function clearCacheForSpaceByUid($tableName, $fields)
{
if (!isset($fields['uid'])) {
return false;
}
$cache = Perf::gatherCache('PW_Space');
$cache->clearCacheForSpaceByUid($fields['uid']);
}
示例5: cleanWeibocontentCacheWithMids
function cleanWeibocontentCacheWithMids($tableName, $fields)
{
if (!isset($fields['mid'])) {
return false;
}
$mids = is_array($fields['mid']) ? $fields['mid'] : array($fields['mid']);
$cache = Perf::gatherCache('pw_weibo_content');
$cache->clearCacheForWeiboContentsByMids($mids);
}
示例6: userApplist
/**
* 获取个人APP列表
*/
function userApplist($uids, $appids = '', $arrt = 0)
{
if (!$uids) {
return false;
}
$this->_app_array = array();
$this->_appslist = $this->getApplist();
$sql_uid = $sql_appid = '';
if (is_numeric($uids)) {
$sql_uid .= ' uid=' . S::sqlEscape($uids);
} elseif (is_array($uids)) {
$sql_uid .= ' uid IN(' . S::sqlImplode($uids) . ')';
}
if (is_numeric($appids)) {
$sql_appid .= ' AND appid=' . S::sqlEscape($appids);
} elseif (is_array($appids)) {
$sql_appid .= ' AND appid IN(' . S::sqlImplode($appids) . ')';
}
//$query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE $sql_uid $sql_appid");
if (perf::checkMemcache()) {
$appids = is_array($appids) ? $appids : array(intval($appids));
$_cacheService = Perf::gatherCache('pw_userapp');
$array = $_cacheService->getUserappsCacheByUids($uids);
foreach ($array as $v) {
if (in_array($v['appid'], $appids)) {
continue;
}
if ($this->_appslist[$v['appid']]) {
if ($arrt == 1) {
$this->_app_array[$v['appid']] = $v['appname'];
} elseif ($arrt == 2) {
$this->_app_array[$v['uid']][$v['appid']] = $v;
} else {
$this->_app_array[] = $v;
}
}
}
} else {
$query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE {$sql_uid} {$sql_appid}");
while ($rt = $this->_db->fetch_array($query)) {
if ($this->_appslist[$rt['appid']]) {
if ($arrt == 1) {
$this->_app_array[$rt['appid']] = $rt['appname'];
} elseif ($arrt == 2) {
$this->_app_array[$rt['uid']][$rt['appid']] = $rt;
} else {
$this->_app_array[] = $rt;
}
}
}
}
if (!$this->_app_array || !$this->appifopen) {
$this->_app_array = array();
}
return $this->_app_array;
}
示例7: run
function run()
{
$tid = $this->getVar('tid');
$db_htmifopen = $this->getVar('db_htmifopen');
$winduid = $this->getVar('winduid');
require_once R_P . 'require/functions.php';
$_cacheService = Perf::gatherCache('pw_threads');
$thread = $page > 1 ? $_cacheService->getThreadByThreadId($tid) : $_cacheService->getThreadAndTmsgByThreadId($tid);
initJob($winduid, "doReply", array('tid' => $tid, 'user' => $thread['author']));
}
示例8: getBbsInfoById
function getBbsInfoById($id)
{
$id = S::int($id);
if ($id < 1) {
return false;
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_bbsinfo');
return $_cacheService->getBbsInfoById($id);
}
$bbsInfoDb = $this->_getBbsInfoDB();
return $bbsInfoDb->get($id);
}
示例9: clearPingLogsCacheByTid
function clearPingLogsCacheByTid($fields)
{
global $tid, $db;
$id = isset($fields['id']) ? $fields['id'] : 1;
if (!$tid && !$id) {
return false;
}
if (!$tid) {
$id = is_array($id) ? end($id) : $id;
$tid = $db->get_value('SELECT tid FROM pw_pinglog WHERE id=' . S::sqlEscape($id));
}
$cache = Perf::gatherCache('pw_ping');
$cache->clearPingLogsCache($tid);
}
示例10: PwSpace
function PwSpace($uid)
{
global $db, $winduid, $db_phopen, $db_dopen, $db_groups_open;
$this->_db =& $db;
$this->uid = $uid;
$userService = L::loadClass('UserService', 'user');
if ($winduid && $winduid == $uid) {
$this->info = $GLOBALS['winddb'];
$this->info['isMe'] = 1;
} elseif ($userdb = $userService->get($this->uid, true, true, true)) {
//$userdb['rvrc'] /= 10;
$this->info = $userdb;
}
if ($this->info) {
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_space');
$space = $_cacheService->getSpaceByUid($this->uid);
} else {
$space = $this->_db->get_one("SELECT * FROM pw_space WHERE uid=" . S::sqlEscape($this->uid));
}
if ($space) {
$this->info = array_merge($this->info, $space);
if ($this->info['banner']) {
list($this->info['banner_s']) = geturl($this->info['banner'], 'lf');
}
} else {
$this->default = true;
}
$spaceGroupid = $this->info['groupid'] == -1 ? $this->info['memberid'] : $this->info['groupid'];
include pwCache::getPath(D_P . "data/groupdb/group_{$spaceGroupid}.php");
$this->info['generalRight'] = $_G;
!$this->info['name'] && ($this->info['name'] = $this->info['username'] . '的个人主页');
!$this->info['skin'] && ($this->info['skin'] = 'default85');
$GLOBALS['uskin'] =& $this->info['skin'];
}
if ($db_dopen) {
$this->models[] = 'diary';
}
if ($db_phopen) {
$this->models[] = 'photos';
}
if ($db_groups_open) {
$this->models[] = 'colony';
}
}
示例11: unserialize
if (is_numeric($o_u) && strlen($hash) == 18) {
require_once R_P . 'require/o_invite.php';
}
}
$visitors = unserialize($space['visitors']);
is_array($visitors) || ($visitors = array());
if (!isset($visitors[$winduid]) || $timestamp - $visitors[$winduid] > 900) {
$visitors[$winduid] = $timestamp;
arsort($visitors);
if (count($visitors) > 12) {
array_pop($visitors);
}
$db->pw_update("SELECT uid FROM pw_space WHERE uid=" . S::sqlEscape($uid), pwQuery::buildClause("UPDATE :pw_table SET visits=visits+1,visitors=:visitors WHERE uid=:uid", array('pw_space', serialize($visitors), intval($uid))), pwQuery::insertClause('pw_space', array('uid' => $uid, 'visits' => 1, 'visitors' => serialize($visitors))));
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_space');
$tmp = $_cacheService->getSpaceByUid($winduid);
$tovisitors = $tmp['tovisitors'];
} else {
$tovisitors = $db->get_value("SELECT tovisitors FROM pw_space WHERE uid=" . S::sqlEscape($winduid));
}
$tovisitors = unserialize($tovisitors);
is_array($tovisitors) || ($tovisitors = array());
if (!isset($tovisitors[$uid]) || $timestamp - $tovisitors[$uid] > 900) {
$tovisitors[$uid] = $timestamp;
arsort($tovisitors);
if (count($tovisitors) > 12) {
array_pop($tovisitors);
}
//$db->update("UPDATE pw_space SET tovisits=tovisits+'1',tovisitors=" . S::sqlEscape(serialize($tovisitors),false) . " WHERE uid=" . S::sqlEscape($winduid));
$db->update(pwQuery::buildClause("UPDATE :pw_table SET tovisits=tovisits+1,tovisitors=:tovisitors WHERE uid=:uid", array('pw_space', serialize($tovisitors), $winduid)));
示例12: cleanThreadCacheWithForumIds
function cleanThreadCacheWithForumIds($fields, $expand = array())
{
if (!isset($fields['fid']) && !isset($expand['fid'])) {
return false;
}
$forumIds = array();
isset($fields['fid']) && ($forumIds = is_array($fields['fid']) ? $fields['fid'] : array($fields['fid']));
isset($expand['fid']) && ($forumIds = array_merge($forumIds, is_array($expand['fid']) ? $expand['fid'] : array($expand['fid'])));
$_cacheService = Perf::gatherCache('pw_threads');
$_cacheService->clearCacheForThreadListByForumIds($forumIds);
}
示例13: getKmdInfosWithCondition
/**
* 孔明灯搜索
* @param array $params
* @param int $offset
* @param int $size
* @return array
*/
function getKmdInfosWithCondition($params, $offset, $size)
{
if (!is_array($params)) {
return false;
}
list($start, $limit, $fid, $uid, $status, $starttime, $endtime) = array(intval($offset), intval($size), intval($params['fid']), intval($params['uid']), intval($params['status']), intval($params['starttime']), intval($params['endtime']));
$kmdInfoDb = $this->_getKmdInfoDB();
$tmpKmdInfo = $kmdInfoDb->getKmdInfosWithCondition($start, $limit, $fid, $uid, $status, $starttime, $endtime);
if (!S::isArray($tmpKmdInfo)) {
return array();
}
$tids = $fids = $uids = $result = array();
foreach ($tmpKmdInfo as $value) {
$tids[$value['kid']] = $value['tid'];
$fids[$value['kid']] = $value['fid'];
$uids[$value['kid']] = $value['uid'];
}
$cacheService = Perf::gatherCache('pw_threads');
$threads = $cacheService->getThreadsByThreadIds(array_unique($tids));
$forumService = L::loadClass('Forums', 'forum');
$forums = $forumService->getForumsByFids(array_unique($fids));
$userService = L::loadClass('UserService', 'user');
$users = $userService->getByUserIds(array_unique($uids));
foreach ($tmpKmdInfo as $value) {
$value['subject'] = $threads[$value['tid']]['subject'];
$value['forumname'] = $forums[$value['fid']]['name'];
$value['username'] = $users[$value['uid']]['username'];
$result[$value['kid']] = $value;
}
return $result;
}
示例14: getWeiboHotTopics
/**
* 获取热门话题
* @param int $o_weibo_hottopicdays 热门话题榜缓存时间
* @param int $timestamp 时间戳
* @param array $db
* @return array $TopicDb
*/
function getWeiboHotTopics()
{
global $o_weibo_hottopicdays, $timestamp, $db;
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_cache');
$rt = $_cacheService->getCacheByName('weiboHotTopics_10');
} else {
$rt = $db->get_one("SELECT * FROM pw_cache WHERE name='weiboHotTopics_10'");
}
$lastData = @unserialize($rt['cache']);
$weiboHotTopics = array();
if ($lastData && $rt['time'] > $timestamp - 7200) {
$weiboHotTopics = (array) $lastData;
} else {
$days = $o_weibo_hottopicdays ? intval($o_weibo_hottopicdays) : 7;
$weiboHotTopics = $this->getHotTopics(10, $days);
/*与上一次比较排名变化*/
foreach (array($lastData) as $k => $v) {
if (!isset($v['order'])) {
continue;
}
if ($v['order'] < $weiboHotTopics[$k]['order']) {
$weiboHotTopics[$k]['change'] = 2;
//排名下降
} elseif ($v['order'] > $weiboHotTopics[$k]['order']) {
$weiboHotTopics[$k]['change'] = 1;
//排名上升
} else {
$weiboHotTopics[$k]['change'] = 0;
}
}
/*
$db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array(
'name' => 'weiboHotTopics_10',
'cache' => serialize($weiboHotTopics),
'time' => $timestamp
)));
*/
pwQuery::replace('pw_cache', array('name' => 'weiboHotTopics_10', 'cache' => serialize($weiboHotTopics), 'time' => $timestamp));
}
return $weiboHotTopics;
}
示例15: getHotActive
/**
* 获取热门活动
* return array
*/
function getHotActive($nums)
{
global $timestamp;
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_cache');
$rt = $_cacheService->getCacheByName('hotactive_3');
} else {
$rt = $this->_db->get_one("SELECT * FROM pw_cache WHERE name='hotactive_3'");
}
if ($rt && $rt['time'] > $timestamp - 1800) {
return unserialize($rt['cache']);
} else {
list($activedb) = $this->searchList(array('createtime_s' => $timestamp - 2592000), 3, 0, 'members', 'DESC');
pwQuery::replace('pw_cache', array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp));
//$this->_db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp)));
return $activedb;
}
}