discuz!x2内存优化数据缓存都缓存了什么内容
discuz!x2后台设置的性能优化->内存优化的接口有memcache、xcache、eaccelerator、apc,选择其一进行缓存优化的,他们都缓存了什么内容呢?经memory('set',.....)函数的执行脚本分析得出,缓存的内容有:
1.首页forum_index调用的相关数据。
执行缓存的脚本:
memory('set', 'forum_index_page_'.$key, array(
'catlist' => $catlist,
'forumlist' => $forumlist,
'sublist' => $sublist,
'whosonline' => $whosonline,
'onlinenum' => $onlinenum,
'membercount' => $membercount,
'guestcount' => $guestcount,
'announcements' => $announcements,
'threads' => $threads,
'posts' => $posts,
'todayposts' => $todayposts,
'onlineinfo' => $onlineinfo,
'announcepm' => $announcepm), getglobal('setting/memory/forumindex/ttl'));
缓存的内容分析得出,主要是所有板块的信息,在线用户的信息,帖子数,主题数,在线信息等内容,内容非常多:
array (
0 =>
array (
'catlist' =>
array (
9 =>
array (
'fid' => '9',
'fup' => '0',
'type' => 'group',
'name' => '时事纵横',
'threads' => '0',
'posts' => '0',
'todayposts' => '0',
'lastpost' => ' 匿名',
'inheritedmod' => '0',
'domain' => '',
'forumcolumns' => '5',
'simple' => '0',
'description' => '',
'moderators' => '',
'icon' => '',
'viewperm' => '',
'redirect' => '',
'extra' =>
array (
),
'forumscount' => 8,
'forums' =>
array (
0 => '10',
1 => '1563',
2 => '1600',
3 => '1611',
4 => '12',
5 => '116',
6 => '110',
7 => '1551',
),
'collapseimg' => 'collapsed_no.gif',
'forumcolwidth' => '19.9%',
'endrows' => '<td> </td><td> </td></tr>',
),
1614 =>
array (
'fid' => '1614',
'fup' => '0',
'type' => 'group',
'name' => '房友会',
'threads' => '0',
'posts' => '0',
'todayposts' => '0',
'lastpost' => '',
'inheritedmod' => '1',
'domain' => '',
'forumcolumns' => '0',
'simple' => '0',
'description' => '',
'moderators' => '<a href="home.php?mod=space&username=eryin5040" class="notabs" c="1">eryin5040</a>, <a href="home.php?mod=space&username=%E7%88%B7%E6%98%AF%E5%A4%A7%E5%8E%A8" class="notabs" c="1">爷是大厨</a>, <a href="home.php?mod=space&username=%E4%BC%98%E4%B8%AD%E9%80%89%E6%82%A0" class="notabs" c="1">优中选悠</a>',
'icon' => '',
'viewperm' => '',
'redirect' => '',
'extra' =>
array (
),
'forumscount' => 24,
'forums' =>
array (
0 => '1615',
1 => '1616',
2 => '1617',
3 => '1618',
4 => '1619',
5 => '1620',
6 => '1621',
7 => '1622',
8 => '1623',
9 => '1624',
10 => '1625',
11 => '1626',
12 => '1627',
13 => '1628',
14 => '1629',
15 => '1630',
16 => '1631',
17 => '1632',
18 => '1633',
19 => '1634',
20 => '1635',
21 => '1636',
22 => '1637',
23 => '1638',
),
'collapseimg' => 'collapsed_no.gif',
),
/*此处省去很多*/
106 =>
array (
'fid' => '106',
'fup' => '23',
'type' => 'forum',
'name' => '影友沙龙',
'threads' => 34345,
'posts' => 364264,
'todayposts' => 0,
'lastpost' =>
array (
0 => 0,
1 => 0,
2 => '',
3 => '',
'author' => '<a href="home.php?mod=space&username=280972319">280972319</a>',
'dateline' => '2011-7-17 23:21:11',
'subject' => '[公告] 缉拿土木--A级通缉令',
'tid' => '17241832',
'authorusername' => '280972319',
),
'inheritedmod' => '0',
'domain' => '',
'forumcolumns' => '3',
'simple' => '0',
'description' => '摄影爱好者的天地 名誉版主: 萧十一郎 老马迷途',
'moderators' => '<a href="home.php?mod=space&username=wmlwf" class="notabs" c="1">wmlwf</a>, <a href="home.php?mod=space&username=%E4%BD%A0%E7%9F%A5%E9%81%93%E6%88%91%E6%98%AF%E8%B0%81%EF%BC%9F" class="notabs" c="1">你知道我是谁?</a>, <a href="home.php?mod=space&username=%E6%91%84%E9%83%8E" class="notabs" c="1">摄郎</a>',
'icon' => '',
'viewperm' => '',
'redirect' => '',
'extra' =>
array (
),
'permission' => 2,
'folder' => '',
'orderid' => 12,
'subforums' => '',
),
28 =>
array (
'fid' => '28',
'fup' => '23',
'type' => 'forum',
'name' => '唯美贴图',
'threads' => '49614',
'posts' => '620759',
'todayposts' => '0',
'lastpost' =>
array (
0 => 0,
1 => 0,
2 => '',
3 => '',
'author' => '<a href="home.php?mod=space&username=hao.456123">hao.456123</a>',
'dateline' => '2011-7-18 01:10:17',
'subject' => '悬浮再显!【有图有真相】',
'tid' => '25251996',
'authorusername' => 'hao.456123',
),
'inheritedmod' => '0',
'domain' => '',
'forumcolumns' => '0',
'simple' => '0',
'description' => '<font color="green">唯美贴图是我们发现美、创造美、欣赏美、传播美的艺术天地;让我们携手营造和谐、融洽、温馨氛围!</font>',
'moderators' => '<a href="home.php?mod=space&username=%E6%9C%A8%E5%A4%B4" class="notabs" c="1">木头</a>, <a href="home.php?mod=space&username=xywsh" class="notabs" c="1">xywsh</a>, <a href="home.php?mod=space&username=%E4%BC%8A%E9%9F%B5%E5%84%BF" class="notabs" c="1">伊韵儿</a>, <a href="home.php?mod=space&username=%E6%9A%AE%E9%9B%A8%E6%B2%89%E9%A6%99" class="notabs" c="1">暮雨沉香</a>, <a href="home.php?mod=space&username=%E6%9E%97%E9%9B%AA" class="notabs" c="1">林雪</a>, <a href="home.php?mod=space&username=%E6%B0%B4%E5%B2%9B" class="notabs" c="1">水岛</a>',
'icon' => '',
'viewperm' => '',
'redirect' => '',
'extra' =>
array (
),
'permission' => 2,
'folder' => '',
'orderid' => 13,
'subforums' => '',
),
),
'sublist' =>
array (
),
'whosonline' =>
array (
0 =>
array (
'uid' => '15998566',
'username' => 'dzwww8519',
'groupid' => '1',
'invisible' => '0',
'lastactivity' => '13:16',
'fid' => '0',
'icon' => 'online_admin.gif',
),
),
'onlinenum' => '1',
'membercount' => 1,
'guestcount' => 0,
'announcements' => '',
'threads' => 2029247,
'posts' => 212848469,
'todayposts' => 0,
'onlineinfo' =>
array (
0 => '4',
1 => '2011-8-11',
),
'announcepm' => 0,
),
)
2.DIY 模块分类缓存内容。
3.在线用户
4.样式风格
等内容,详细的内容都缓存服务器上查找吧,可以通过“var_export(unserialize($redis->get("key值")));”这种方式把数组变量呈现出来。通过搜索源码的memory('set',...)就知道缓存了多少个键值了。注意:cachedata函数中的遍历加载缓存。自己再好好研究吧。
查看完整版本: discuz!x2内存优化数据缓存都缓存了什么内容
Tags: