aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/mod_muc.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-23 18:59:21 +0200
committerKim Alvefur <zash@zash.se>2018-06-23 18:59:21 +0200
commit6d2a2e9153b575a02f7d501888335df9e4af0578 (patch)
tree02c01d4642be65bd95f0fae13c3b9e2e3c678bd0 /plugins/muc/mod_muc.lua
parent53672d196c0e94b527f274dd11fde720f02a8755 (diff)
downloadprosody-6d2a2e9153b575a02f7d501888335df9e4af0578.tar.gz
prosody-6d2a2e9153b575a02f7d501888335df9e4af0578.zip
MUC: Measure cache hits and misses
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r--plugins/muc/mod_muc.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index ab845e5b..e4278297 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -135,6 +135,8 @@ end
local max_rooms = module:get_option_number("muc_max_rooms");
local max_live_rooms = module:get_option_number("muc_room_cache_size", 100);
+local room_hit = module:measure("room_hit", "rate");
+local room_miss = module:measure("room_miss", "rate")
local room_eviction = module:measure("room_eviction", "rate");
local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room)
if max_rooms then
@@ -217,9 +219,11 @@ end
function get_room_from_jid(room_jid)
local room = rooms:get(room_jid);
if room then
+ room_hit();
rooms:set(room_jid, room); -- bump to top;
return room;
end
+ room_miss();
return restore_room(room_jid);
end