mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-22 02:01:28 +02:00
cache categories:cid and cid:<cid>:children
these rarely change, no need to go to db for them
This commit is contained in:
@@ -8,6 +8,7 @@ cacheController.get = function (req, res) {
|
||||
var postCache = require('../../posts/cache');
|
||||
var groupCache = require('../../groups').cache;
|
||||
var objectCache = require('../../database').objectCache;
|
||||
var localCache = require('../../cache');
|
||||
|
||||
var avgPostSize = 0;
|
||||
var percentFull = 0;
|
||||
@@ -32,11 +33,20 @@ cacheController.get = function (req, res) {
|
||||
max: groupCache.max,
|
||||
itemCount: groupCache.itemCount,
|
||||
percentFull: ((groupCache.length / groupCache.max) * 100).toFixed(2),
|
||||
dump: req.query.debug ? JSON.stringify(groupCache.dump(), null, 4) : false,
|
||||
hits: utils.addCommas(String(groupCache.hits)),
|
||||
misses: utils.addCommas(String(groupCache.misses)),
|
||||
hitRatio: (groupCache.hits / (groupCache.hits + groupCache.misses)).toFixed(4),
|
||||
},
|
||||
localCache: {
|
||||
length: localCache.length,
|
||||
max: localCache.max,
|
||||
itemCount: localCache.itemCount,
|
||||
percentFull: ((localCache.length / localCache.max) * 100).toFixed(2),
|
||||
dump: req.query.debug ? JSON.stringify(localCache.dump(), null, 4) : false,
|
||||
hits: utils.addCommas(String(localCache.hits)),
|
||||
misses: utils.addCommas(String(localCache.misses)),
|
||||
hitRatio: (localCache.hits / (localCache.hits + localCache.misses)).toFixed(4),
|
||||
},
|
||||
};
|
||||
|
||||
if (objectCache) {
|
||||
@@ -45,7 +55,6 @@ cacheController.get = function (req, res) {
|
||||
max: objectCache.max,
|
||||
itemCount: objectCache.itemCount,
|
||||
percentFull: ((objectCache.length / objectCache.max) * 100).toFixed(2),
|
||||
dump: req.query.debug ? JSON.stringify(objectCache.dump(), null, 4) : false,
|
||||
hits: utils.addCommas(String(objectCache.hits)),
|
||||
misses: utils.addCommas(String(objectCache.misses)),
|
||||
hitRatio: (objectCache.hits / (objectCache.hits + objectCache.misses)).toFixed(4),
|
||||
|
||||
Reference in New Issue
Block a user