@ -23,6 +23,9 @@ cacheController.get = function (req, res) {
itemCount: postCache.itemCount,
percentFull: percentFull,
avgPostSize: avgPostSize,
hits: utils.addCommas(String(postCache.hits)),
misses: utils.addCommas(String(postCache.misses)),
hitRatio: ((postCache.hits / (postCache.hits + postCache.misses) || 0)).toFixed(4),
},
groupCache: {
length: groupCache.length,
@ -8,5 +8,7 @@ var cache = LRU({
length: function (n) { return n.length; },
maxAge: 0,
});
cache.hits = 0;
cache.misses = 0;
module.exports = cache;
@ -27,8 +27,10 @@ module.exports = function (Posts) {
if (postData.pid && cache.has(String(postData.pid))) {
postData.content = cache.get(String(postData.pid));
cache.hits += 1;
return callback(null, postData);
}
cache.misses += 1;
async.waterfall([
function (next) {
@ -19,6 +19,11 @@
[[admin/advanced/cache:percent-full, {postCache.percentFull}]]
</div>
<label>Hits:</label> <span>{postCache.hits}</span><br/>
<label>Misses:</label> <span>{postCache.misses}</span><br/>
<label>Hit Ratio:</label> <span>{postCache.hitRatio}</span><br/>
<div class="form-group">
<label for="postCacheSize">[[admin/advanced/cache:post-cache-size]]</label>
<input id="postCacheSize" type="text" class="form-control" value="" data-field="postCacheSize">