コード例 #1
0
function getranklistcache($name, $dateline = '')
{
    global $_G;
    if (is_ranklistcache_available($name) || $_G['ranklist_cacheupdated']) {
        $ranklist = $_G['cache']['ranklist_index'][$name];
        unset($ranklist['lastupdated']);
        return $ranklist;
    }
    switch ($name) {
        case 'pictures':
            $ranklist = getranklist_pictures_index(9);
            break;
        case 'threads_hot':
            $ranklist = getranklist_threads(10, $dateline, 'heats DESC');
            break;
        case 'threads_fav':
            $ranklist = getranklist_threads(10, 0, 'favtimes DESC');
            break;
        case 'blogs_hot':
            $ranklist = getranklist_blogs(10, $dateline);
            break;
        case 'polls_hot':
            $ranklist = getranklist_polls(10, $dateline);
            break;
        case 'activities_hot':
            $ranklist = getranklist_activities(10, $dateline);
            break;
        case 'girllist':
            $ranklist = getranklist_girls(0, 10);
            break;
    }
    $ranklist['lastupdated'] = TIMESTAMP;
    ranklist_cache_push($name, $ranklist);
    return $ranklist;
}
コード例 #2
0
function getranklistcache_threads()
{
    global $_G, $cache_time, $cache_num, $dateline, $orderby;
    $ranklistvars = array();
    loadcache('ranklist_thread');
    $ranklistvars =& $_G['cache']['ranklist_thread'][$_G['gp_before'] . '_' . $_G['gp_orderby']];
    if (!empty($ranklistvars['lastupdated']) && TIMESTAMP - $ranklistvars['lastupdated'] < $cache_time) {
        return $ranklistvars;
    }
    $ranklistvars = getranklist_threads($cache_num, $dateline, $orderby);
    $ranklistvars['lastupdated'] = TIMESTAMP;
    $ranklistvars['lastupdate'] = dgmdate(TIMESTAMP);
    $ranklistvars['nextupdate'] = dgmdate(TIMESTAMP + $cache_time);
    $_G['cache']['ranklist_thread'][$_G['gp_before'] . '_' . $_G['gp_orderby']] = $ranklistvars;
    save_syscache('ranklist_thread', $_G['cache']['ranklist_thread']);
    return $ranklistvars;
}