Files
NodeBB/src/controllers/admin/cache.js

35 lines
918 B
JavaScript
Raw Normal View History

'use strict';
var cacheController = {};
cacheController.get = function (req, res, next) {
var postCache = require('../../posts/cache');
var groupCache = require('../../groups').cache;
var avgPostSize = 0;
var percentFull = 0;
if (postCache.itemCount > 0) {
avgPostSize = parseInt((postCache.length / postCache.itemCount), 10);
percentFull = ((postCache.length / postCache.max) * 100).toFixed(2);
}
res.render('admin/advanced/cache', {
postCache: {
length: postCache.length,
max: postCache.max,
itemCount: postCache.itemCount,
percentFull: percentFull,
2016-09-14 21:34:36 +03:00
avgPostSize: avgPostSize
},
groupCache: {
length: groupCache.length,
max: groupCache.max,
itemCount: groupCache.itemCount,
percentFull: ((groupCache.length / groupCache.max) * 100).toFixed(2),
2016-09-14 21:30:29 +03:00
dump: req.query.debug ? JSON.stringify(groupCache.dump(), null, 4) : false
}
});
};
module.exports = cacheController;