layered-loader
Version:
Data loader with support for caching and fallback data sources
30 lines (24 loc) • 662 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GET_OR_SET_ZERO_WITHOUT_TTL = exports.GET_OR_SET_ZERO_WITH_TTL = void 0;
exports.GET_OR_SET_ZERO_WITH_TTL = `
local key = KEYS[1]
local ttl = ARGV[1]
local current_value = redis.call('GET', key)
if current_value == false then
redis.call('SET', key, 0)
redis.call('PEXPIRE', key, ttl)
return 0
end
return current_value
`;
exports.GET_OR_SET_ZERO_WITHOUT_TTL = `
local key = KEYS[1]
local current_value = redis.call('GET', key)
if current_value == false then
redis.call('SET', key, 0)
return 0
end
return current_value
`;
//# sourceMappingURL=lua.js.map