]> source.dussan.org Git - rspamd.git/commitdiff
Cache atom results.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Mar 2015 21:52:39 +0000 (21:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Mar 2015 21:52:39 +0000 (21:52 +0000)
src/plugins/lua/spamassassin.lua

index 8aad56618f9864e6e86155e8e56586899c4ddc7f..345e96b25c053dfa9fc450f0b81154e5422355fa 100644 (file)
@@ -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