aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-25 21:52:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-25 21:52:39 +0000
commitc27051a9738aa07cc1041e253d18fbacc9f51d98 (patch)
tree9daf62ac6618edd3ae319f3ab1ac38321f3b2a6d /src/plugins/lua
parent5aa8400c1fddc761a333b333c72ad00e108702c2 (diff)
downloadrspamd-c27051a9738aa07cc1041e253d18fbacc9f51d98.tar.gz
rspamd-c27051a9738aa07cc1041e253d18fbacc9f51d98.zip
Cache atom results.
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/spamassassin.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 8aad56618..345e96b25 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -383,7 +383,12 @@ end
local function process_atom(atom, task)
local atom_cb = atoms[atom]
if atom_cb then
- return atom_cb(task)
+ local res = task:cache_get(atom)
+ if res < 0 then
+ res = atom_cb(task)
+ task:cache_set(atom, res)
+ end
+ return res
else
rspamd_logger.err('Cannot find atom ' .. atom)
end