diff --git a/lib/commands/admin-rpc.js b/lib/commands/admin-rpc.js index a7cb59798..32e9b9947 100644 --- a/lib/commands/admin-rpc.js +++ b/lib/commands/admin-rpc.js @@ -19,6 +19,26 @@ var getFileDescriptorLimit = function (env, server, cb) { Ulimit(cb); }; +var getCacheStats = function (env, server, cb) { + var metaCount = 0; + var channelCount = 0; + + var meta = env.metadata_cache; + for (var x in meta) { + if (meta.hasOwnProperty(x)) { metaCount++; } + } + + var channels = env.channel_cache; + for (var y in channels) { + if (channels.hasOwnProperty(y)) { channelCount++; } + } + + cb(void 0, { + metadata: metaCount, + channel: channelCount, + }); +}; + var getActiveSessions = function (Env, Server, cb) { var stats = Server.getSessionStats(); cb(void 0, [ @@ -137,6 +157,7 @@ var commands = { GET_FILE_DESCRIPTOR_COUNT: getFileDescriptorCount, GET_FILE_DESCRIPTOR_LIMIT: getFileDescriptorLimit, SET_DEFAULT_STORAGE_LIMIT: setDefaultStorageLimit, + GET_CACHE_STATS: getCacheStats, }; Admin.command = function (Env, safeKey, data, _cb, Server) {