aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-12-06 02:09:52 +0100
committerKim Alvefur <zash@zash.se>2015-12-06 02:09:52 +0100
commit6c08f31979e9de47e13790b102c9743cb4378e22 (patch)
treebad31cc308c3fe56803d11b69affdbd9069f2d99 /plugins
parent4cc144b4fcffb34842c212896593c4df8c83740b (diff)
downloadprosody-6c08f31979e9de47e13790b102c9743cb4378e22.tar.gz
prosody-6c08f31979e9de47e13790b102c9743cb4378e22.zip
mod_blocklist: Expand comments on caching of blocklists
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_blocklist.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua
index add7abb3..a38d2a0f 100644
--- a/plugins/mod_blocklist.lua
+++ b/plugins/mod_blocklist.lua
@@ -19,11 +19,17 @@ local jid_split = require"util.jid".split;
local storage = module:open_store();
local sessions = prosody.hosts[module.host].sessions;
--- Cache of blocklists by username may randomly expire at any time
+-- First level cache of blocklists by username.
+-- Weak table so may randomly expire at any time.
local cache = setmetatable({}, { __mode = "v" });
--- Second level of caching, keeps a fixed number of items,
--- also anchors items in the above cache
+-- Second level of caching, keeps a fixed number of items, also anchors
+-- items in the above cache.
+--
+-- The size of this affects how often we will need to load a blocklist from
+-- disk, which we want to avoid during routing. On the other hand, we don't
+-- want to use too much memory either, so this can be tuned by advanced
+-- users. TODO use science to figure out a better default, 64 is just a guess.
local cache_size = module:get_option_number("blocklist_cache_size", 64);
local cache2 = require"util.cache".new(cache_size);