removeDeduplicationKey-1.lua 393 B

12345678910111213141516171819202122
  1. --[[
  2. Remove deduplication key if it matches the job id.
  3. Input:
  4. KEYS[1] deduplication key
  5. ARGV[1] job id
  6. Output:
  7. 0 - false
  8. 1 - true
  9. ]]
  10. local rcall = redis.call
  11. local deduplicationKey = KEYS[1]
  12. local jobId = ARGV[1]
  13. local currentJobId = rcall('GET', deduplicationKey)
  14. if currentJobId and currentJobId == jobId then
  15. return rcall("DEL", deduplicationKey)
  16. end
  17. return 0