Skip to main content

CTRLRedis API

API

Redis.set(key, value, ttl, cb)

The set function work with JSON object.
JSON is automatically stringified.

Promise

Redis.set
local set = Redis.set("example", "hello", 120)
print(set) -- OK

Callback

Redis.set
Redis.set("example", "hello", 120, function(result)
print(result) -- Return: OK
end)

Redis.get(key, cb)

The get function work with JSON object.
JSON is automatically parsed.

Promise

Redis.get
local get = Redis.set("example")
print(get) -- Return: hello

Callback

Redis.get
Redis.set("example", function(result)
print(result) -- Return: hello
end)

Redis.del(key, cb)

Promise

Redis.del
local del = Redis.del("example")
print(del) -- Return: 1 deleted, 0 not exist

Callback

Redis.del
Redis.del("example", function(result)
print(result) -- Return: 1 deleted, 0 not exist
end)