Skip to content

Commit 7679858

Browse files
authored
Fix FUNCTION DUMP outupdated examples (#2670)
The old example uses an old format, which is no longer supported, it will return an `ERR Pre-GA function format not supported` error. Also the FUNCTION LIST example is also a bit outdated.
1 parent ccd3a13 commit 7679858

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

commands/function-dump.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ The following example shows how to dump loaded libraries using `FUNCTION DUMP` a
99
Then, it restores the original libraries from the serialized payload with `FUNCTION RESTORE`.
1010

1111
```
12+
redis> FUNCTION LOAD "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)"
13+
"mylib"
1214
redis> FUNCTION DUMP
13-
"\xf6\x05mylib\x03LUA\x00\xc3@D@J\x1aredis.register_function('my@\x0b\x02', @\x06`\x12\x11keys, args) return`\x0c\a[1] end)\n\x00@\n)\x11\xc8|\x9b\xe4"
15+
"\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"
1416
redis> FUNCTION FLUSH
1517
OK
16-
redis> FUNCTION RESTORE "\xf6\x05mylib\x03LUA\x00\xc3@D@J\x1aredis.register_function('my@\x0b\x02', @\x06`\x12\x11keys, args) return`\x0c\a[1] end)\n\x00@\n)\x11\xc8|\x9b\xe4"
18+
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"
1719
OK
1820
redis> FUNCTION LIST
1921
1) 1) "library_name"
2022
2) "mylib"
2123
3) "engine"
2224
4) "LUA"
23-
5) "description"
24-
6) (nil)
25-
7) "functions"
26-
8) 1) 1) "name"
25+
5) "functions"
26+
6) 1) 1) "name"
2727
2) "myfunc"
2828
3) "description"
2929
4) (nil)
30+
5) "flags"
31+
6) (empty array)
3032
```

0 commit comments

Comments
 (0)