commit b2d42ef: [Minor] Fix cache key

Andrew Lewis nerf at judo.za.org
Fri Oct 2 12:21:06 UTC 2020


Author: Andrew Lewis
Date: 2020-10-01 19:11:59 +0200
URL: https://github.com/rspamd/rspamd/commit/b2d42ef071ad43773d68e9b9da3d3c1f741362a2

[Minor] Fix cache key

---
 lualib/lua_util.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 9fd15fa5a..521424966 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -951,10 +951,16 @@ exports.extract_specific_urls = function(params_or_task, lim, need_emails, filte
     if params.prefix then
       cache_key = params.prefix
     else
-      cache_key = string.format('sp_urls_%d%s%s%s', params.limit,
+      local cache_key_suffix
+      if params.flags then
+        cache_key_suffix = table.concat(params.flags) .. (params.flags_mode or '')
+      else
+        cache_key_suffix = string.format('%s%s%s',
           tostring(params.need_emails or false),
           tostring(params.need_images or false),
           tostring(params.need_content or false))
+      end
+      cache_key = string.format('sp_urls_%d%s', params.limit, cache_key_suffix)
     end
     local cached = params.task:cache_get(cache_key)
 


More information about the Commits mailing list