-
Notifications
You must be signed in to change notification settings - Fork 8
Description
We currently comment all return statements from del.lua using
values.put("delscript", readLuaScriptFromClasspath(LuaScript.DELETE).replaceAll("return", "--return"));
and then inline the modified script into cleanup.lua
for key,value in pairs(resourcesToClean) do
redis.log(redis.LOG_NOTICE, "cleanup resource: "..value)
KEYS[1] = string.sub(value, resourcePrefixLength+1, string.len(value))
--%(delscript) <-- del.lua with commented return statements
counter = counter + 1
end
There are several disadvantages with this approach:
a) We can't use functions such as
local function isResource(key)
return redis.call('exists',resourcesPrefix..key) <-- will be commented
end
in del.lua
b) We can't do a "return early from method"
c) We also increment the counter when nothing has been deleted
Hence the idea to get rid of the cleanup.lua and implement this in Java (but still call the del.lua).