mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 06:46:02 +02:00
feat: add hits/sec for cache
This commit is contained in:
@@ -10,7 +10,7 @@ cacheController.get = async function (req, res) {
|
||||
const groupCache = require('../../groups').cache;
|
||||
const { objectCache } = require('../../database');
|
||||
const localCache = require('../../cache');
|
||||
|
||||
const uptimeInSeconds = process.uptime();
|
||||
function getInfo(cache) {
|
||||
return {
|
||||
length: cache.length,
|
||||
@@ -21,6 +21,7 @@ cacheController.get = async function (req, res) {
|
||||
((cache.length / cache.maxSize) * 100).toFixed(2) :
|
||||
((cache.itemCount / cache.max) * 100).toFixed(2),
|
||||
hits: utils.addCommas(String(cache.hits)),
|
||||
hitsPerSecond: (cache.hits / uptimeInSeconds).toFixed(2),
|
||||
misses: utils.addCommas(String(cache.misses)),
|
||||
hitRatio: ((cache.hits / (cache.hits + cache.misses) || 0)).toFixed(4),
|
||||
enabled: cache.enabled,
|
||||
|
||||
Reference in New Issue
Block a user