Skip to content

Commit 858a9e2

Browse files
committed
add redis command mode desc
1 parent 8125871 commit 858a9e2

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

meta/3rd/skynet/library/skynet/db/redis.lua

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,55 @@ local redis = {}
99
---@field db integer
1010
---@field username? string
1111

12-
---其他指令还可以动态生成
13-
---更多命令查看 https://www.redis.com.cn/commands.html
12+
---一个 Redis 连接,返回这个 Command 对象。当在此对象上执行指令时,若指令不存在,会在第一次执行的时候构造
13+
---指令对象的方法。
14+
---指令的参数的第一个可以是 nil, 也可以是 table,还可以有多个参数。
15+
---异步形式,底层用 socketchannel 进行通信,这点要注意。
16+
---更多命令查看 [https://www.redis.com.cn/commands.html](https://www.redis.com.cn/commands.html)
17+
---@see socketchannel
18+
---@class command
1419
local command = {}
15-
function command:disconnect() end
16-
function command:exists(k) end
17-
function command:sismember(key, value) end
18-
function command:pipeline(ops, resp) end
20+
function command:disconnect()
21+
end
22+
function command:exists(k)
23+
end
24+
function command:sismember(key, value)
25+
end
26+
function command:pipeline(ops, resp)
27+
end
1928

2029
--- watch mode, only can do SUBSCRIBE, PSUBSCRIBE, UNSUBSCRIBE, PUNSUBSCRIBE, PING and QUIT command.
30+
--- we can call watch:message in endless loop.
31+
---@class watch
2132
local watch = {}
22-
function watch:disconnect() end
33+
function watch:disconnect()
34+
end
2335
---阻塞模式读取消息
24-
function watch:message() end
36+
function watch:message()
37+
end
2538
---subscribe channel
26-
function watch:subscribe(...) end
39+
function watch:subscribe(...)
40+
end
2741
---pattern subscribe channels
28-
function watch:psubscribe(...) end
42+
function watch:psubscribe(...)
43+
end
2944
---unsubscribe
30-
function watch:unsubscribe(...) end
45+
function watch:unsubscribe(...)
46+
end
3147
---punsubscribe
32-
function watch:punsubscribe(...) end
48+
function watch:punsubscribe(...)
49+
end
3350

3451
---connect to redis server
3552
---@param conf redisconfig
3653
---@return command
37-
function redis.connect(conf) end
54+
function redis.connect(conf)
55+
end
3856

3957
---connect to redis server on watch mode
4058
---@param conf redisconfig
4159
---@return watch
42-
function redis.watch(conf) end
60+
function redis.watch(conf)
61+
end
4362

4463
return redis

0 commit comments

Comments
 (0)