Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement cleanup of expired resources in Java? #83

Open
dominik-cnx opened this issue Sep 10, 2019 · 0 comments
Open

implement cleanup of expired resources in Java? #83

dominik-cnx opened this issue Sep 10, 2019 · 0 comments

Comments

@dominik-cnx
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants