HEX
Server: Apache/2
System: Linux nexus-01 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User: aglcoke (1118)
PHP: 8.2.31
Disabled: mail,exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/1/task/1/root/usr/share/rspamd/lualib/redis_scripts/neural_maybe_invalidate.lua
-- Lua script to invalidate ANNs by rank
-- Uses the following keys
-- key1 - prefix for keys
-- key2 - number of elements to leave

local card = redis.call('ZCARD', KEYS[1])
local lim = tonumber(KEYS[2])
if card > lim then
  local to_delete = redis.call('ZRANGE', KEYS[1], 0, card - lim - 1)
  if to_delete then
    for _, k in ipairs(to_delete) do
      local tb = cjson.decode(k)
      if type(tb) == 'table' and type(tb.redis_key) == 'string' then
        redis.call('DEL', tb.redis_key)
        -- Also train vectors
        redis.call('DEL', tb.redis_key .. '_spam_set')
        redis.call('DEL', tb.redis_key .. '_ham_set')
      end
    end
  end
  redis.call('ZREMRANGEBYRANK', KEYS[1], 0, card - lim - 1)
  return to_delete
else
  return {}
end