Add a cluster-backed message cache.

This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2020-07-30 11:39:14 -04:00
1 parent 639898ec07
commit 6fc1b4c6c0
15 files changed
+690 -59

No files matched your search

+11 -2
View File
@@ -1,7 +1,16 @@
-- keys: queue_key [1], queue_metadata_key [2], queue_total_index [3]
-- argv: message [1], current_time [2], sender (possibly null) [3], guid [4]
-- argv: message [1], current_time [2], sender (possibly null) [3], guid [4], messageId (possibly null) [5]
local messageId
if ARGV[5] ~= nil then
-- TODO: Remove this branch (and ARGV[5]) once the migration to a clustered message cache is finished
messageId = tonumber(ARGV[5])
redis.call("HSET", KEYS[2], "counter", messageId)
else
messageId = redis.call("HINCRBY", KEYS[2], "counter", 1)
end
local messageId = redis.call("HINCRBY", KEYS[2], "counter", 1)
redis.call("ZADD", KEYS[1], "NX", messageId, ARGV[1])
if ARGV[3] ~= "nil" then