FUNCTION DUMP
将所有库转储到序列化的二进制负载中。
语法
FUNCTION DUMP
引入版本:7.0.0
复杂度摘要:O(N)
返回已加载库的序列化有效负载。您可以稍后使用 FUNCTION RESTORE 命令恢复序列化的有效负载。
更多信息请参阅Redis功能介绍。
示例
以下示例显示如何使用 FUNCTION DUMP 转储加载的库,然后调用 FUNCTION FLUSH 删除所有库。然后,它使用 FUNCTION RESTORE 从序列化的有效负载中恢复原始库。
redis> FUNCTION LOAD "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)"
"mylib"
redis> FUNCTION DUMP
"\xf5\xc3@X@]\x1f#!lua name=mylib \n redis.registe\rr_function('my@\x0b\x02', @\x06`\x12\nkeys, args) 6\x03turn`\x0c\a[1] end)\x0c\x00\xba\x98\xc2\xa2\x13\x0e$\a"
redis> FUNCTION FLUSH
OK
redis> FUNCTION RESTORE "\xf5\xc3@X@]\x1f#!lua name=mylib \n redis.registe\rr_function('my@\x0b\x02', @\x06`\x12\nkeys, args) 6\x03turn`\x0c\a[1] end)\x0c\x00\xba\x98\xc2\xa2\x13\x0e$\a"
OK
redis> FUNCTION LIST
1) 1) "library_name"
2) "mylib"
3) "engine"
4) "LUA"
5) "functions"
6) 1) 1) "name"
2) "myfunc"
3) "description"
4) (nil)
5) "flags"
6) (empty array)
Redis Software 与 Redis Cloud 兼容性
| Redis 软件 |
Redis Cloud |
说明 |
|---|---|---|
| ✅ 标准 |
✅ 标准 |
返回值
RESP2
批量字符串回复:序列化的有效负载
RESP3
批量字符串回复:序列化的有效负载
资料来源:Redis 官方 FUNCTION DUMP 文档;中文内容参考 Redis 文档许可。