discuz!x2内存优化数据缓存都缓存了什么内容
discuz!x2后台设置的性能优化->内存优化的接口有memcache、xcache、eaccelerator、apc,选择其一进行缓存优化的,他们都缓存了什么内容呢?
经memory(‘set’,…..)函数的执行脚本分析得出,缓存的内容有:
1.首页forum_index调用的相关数据。
执行缓存的脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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')); |
缓存的内容分析得出,主要是所有板块的信息,在线用户的信息,帖子数,主题数,在线信息等内容,内容非常多:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
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.
3.在线用户
4.样式风格
等内容,详细的内容都缓存服务器上查找吧,可以通过“var_export(unserialize($redis->get(“key值”)));”这种方式把数组变量呈现出来。通过搜索源码的memory(‘set’,…)就知道缓存了多少个键值了。注意:cachedata函数中的遍历加载缓存。自己再好好研究吧。