| | |
| | | local mode = ARGV[1] |
| | | local occupyValue = ARGV[2] |
| | | local taskValue = ARGV[3] |
| | | local ttl = tonumber(ARGV[4]) |
| | | local occupyValue = ARGV[1] |
| | | local ttl = tonumber(ARGV[2]) |
| | | |
| | | if mode == 'PUTAWAY' then |
| | | if redis.call('exists', KEYS[1]) == 1 or redis.call('exists', KEYS[2]) == 1 then |
| | | return 0 |
| | | end |
| | | redis.call('psetex', KEYS[1], ttl, occupyValue) |
| | | redis.call('psetex', KEYS[2], ttl, taskValue) |
| | | return 1 |
| | | end |
| | | |
| | | if redis.call('exists', KEYS[2]) == 1 then |
| | | if redis.call('exists', KEYS[1]) == 1 then |
| | | return 0 |
| | | end |
| | | redis.call('psetex', KEYS[2], ttl, taskValue) |
| | | redis.call('psetex', KEYS[1], ttl, occupyValue) |
| | | return 1 |