"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UNREGISTER_SCRIPT = exports.CLEANUP_SCRIPT = exports.READ_ALL_SCRIPT = exports.REGISTER_SCRIPT = void 0;
exports.REGISTER_SCRIPT = `
redis.call('SET', KEYS[1], ARGV[1], 'EX', tonumber(ARGV[2]))
redis.call('SADD', KEYS[2], KEYS[1])
return 1
`;
exports.READ_ALL_SCRIPT = `
local members = redis.call('SMEMBERS', KEYS[1])
if #members == 0 then return {} end
local values = redis.call('MGET', unpack(members))
local result = {}
for i, v in ipairs(values) do
  if v ~= false then
    table.insert(result, v)
  end
end
return result
`;
exports.CLEANUP_SCRIPT = `
local members = redis.call('SMEMBERS', KEYS[1])
if #members == 0 then return 0 end
local values = redis.call('MGET', unpack(members))
local removed = 0
for i, v in ipairs(values) do
  if v == false then
    redis.call('SREM', KEYS[1], members[i])
    removed = removed + 1
  end
end
return removed
`;
exports.UNREGISTER_SCRIPT = `
redis.call('DEL', KEYS[1])
redis.call('SREM', KEYS[2], KEYS[1])
return 1
`;
//# sourceMappingURL=lua-scripts.js.map