display posts cache capacity/post count

This commit is contained in:
barisusakli
2015-04-20 18:23:09 -04:00
parent 1f06f90a50
commit 0c91391c75
4 changed files with 50 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ var adminController = {
events: {},
logs: {},
database: {},
postCache: {},
plugins: {},
languages: {},
settings: {},
@@ -236,6 +237,26 @@ adminController.logs.get = function(req, res, next) {
});
};
adminController.postCache.get = function(req, res, next) {
var cache = require('../posts/cache');
var avgPostSize = 0;
var percentFull = 0;
if (cache.itemCount > 0) {
avgPostSize = parseInt((cache.length / cache.itemCount), 10);
percentFull = ((cache.length / cache.max) * 100).toFixed(2);
}
res.render('admin/advanced/post-cache', {
cache: {
length: cache.length,
max: cache.max,
itemCount: cache.itemCount,
percentFull: percentFull,
avgPostSize: avgPostSize
}
});
};
adminController.plugins.get = function(req, res, next) {
plugins.getAll(function(err, plugins) {
if (err || !Array.isArray(plugins)) {