t.tinystruct.1.4.5.source-code.lock.lua Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tinystruct Show documentation
Show all versions of tinystruct Show documentation
A simple framework for Java development. Simple is hard, Complex is easy. Better thinking, better design.
local key = KEYS[1]
local content = KEYS[2]
local ttl = ARGV[1]
local lock_set = redis.call('setnx', key, content)
if lock_set == 1 then
redis.call('pexpire', key, ttl)
else
local value = redis.call('get', key)
if(value == content) then
lock_set = 1; redis.call('pexpire', key, ttl)
end
end
return lock_set;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy