函数转储

Syntax
FUNCTION DUMP
Available since:
7.0.0
Time complexity:
O(N) where N is the number of functions
ACL categories:
@slow, @scripting,

返回已加载库的序列化有效载荷。 您稍后可以使用FUNCTION RESTORE命令恢复序列化的有效载荷。

更多信息请参考Introduction to Redis Functions

示例

以下示例展示了如何使用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)

RESP2/RESP3 回复

Bulk string reply: the serialized payload
RATE THIS PAGE
Back to top ↑