rewrite redis driver , avoid table.concat

This commit is contained in:
Cloud Wu
2015-11-13 12:30:46 +08:00
parent 86d9d52308
commit 107be7ee8c
2 changed files with 68 additions and 42 deletions

View File

@@ -33,29 +33,27 @@ skynet.start(function()
do
print("test function")
local ret = db:pipelining(function (red)
red:multi()
red:hincrby("hello", 1, 1)
red:del("hello")
red:hmset("hello", 1, 1, 2, 2, 3, 3)
red:hgetall("hello")
red:exec()
end)
print(ret[1].out)
print(ret[2].out)
print(ret[3].out)
for k, v in pairs(read_table(ret[4].out)) do
-- ret is the result of red:exec()
for k, v in pairs(read_table(ret[4])) do
print(k, v)
end
end
do
print("test table")
local ret = db:pipeline {
local ret = db:pipeline({
{"hincrby", "hello", 1, 1},
{"del", "hello"},
{"hmset", "hello", 1, 1, 2, 2, 3, 3},
{"hgetall", "hello"},
}
}, {}) -- offer a {} for result
print(ret[1].out)
print(ret[2].out)