FUNCTION-DUMP(3valkey)
π function-dump (Valkey Command Manual, bestie edition) π
okay so. welcome to the Valkey Command Manual page for FUNCTION DUMP, and honestly? it's giving "pack up your whole wardrobe in one suitcase" energy. let's get into it π
β¨ NAME β¨
function-dump β dumps all libraries into a serialized binary payload. that's it. that's the whole job. no cap. π«Ά
β¨ SYNOPSIS β¨
FUNCTION DUMP
literally just those two words, bestie. no args, no flags, no drama. iconic behavior honestly. π
β¨ DESCRIPTION β¨
so here's the tea β β FUNCTION DUMP returns the serialized payload of all your loaded libraries. think of it like a little zip file of everything you've loaded, except it's a blob of bytes and you should not try to read it with your eyeballs.
you can restore that serialized payload later with the valkey-function-restore(7) FUNCTION RESTORE command. it's a save-and-load situation. dump now, restore later, no stress. π¦
want the full lore? go read valkey-functions-intro(7) Introduction to Valkey Functions. that's the prequel, iykyk. β¨
β¨ REPLY β¨
valkey-protocol(7) Bulk string reply: the serialized payload π
yep. one big bulk string. that's your whole library collection, baby. π
β¨ COMPLEXITY β¨
O(N) where N is the number of functions
so the more functions you got, the longer it takes. math is math, bestie. π
β¨ ACL CATEGORIES β¨
@scripting@slow
β¨ HISTORY β¨
- Available since: 7.0.0 β
β¨ EXAMPLES β¨
okay this example is so satisfying, watch this. it dumps the loaded libraries with FUNCTION DUMP, then it calls valkey-function-flush(7) FUNCTION FLUSH which deletes all the libraries π (yes, really, gone gone), and then it restores the original libraries from the serialized payload with FUNCTION RESTORE. main character arc fr fr. π
127.0.0.1:6379> FUNCTION LOAD "#!lua name=mylib \n server.register_function('myfunc', function(keys, args) return args[1] end)"
"mylib"
127.0.0.1:6379> FUNCTION DUMP
"\xf5\xc3@X@]\x1f#!lua name=mylib \n server.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"
127.0.0.1:6379> FUNCTION FLUSH
OK
127.0.0.1:6379> FUNCTION RESTORE "\xf5\xc3@X@]\x1f#!lua name=mylib \n server.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
127.0.0.1:6379> 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)
see?? mylib came BACK. the payload said "not today" and restored the whole vibe. ate and left no crumbs π
β¨ SEE ALSO β¨
eval(3valkey), evalsha(3valkey), evalsha_ro(3valkey), eval_ro(3valkey), fcall(3valkey), fcall_ro(3valkey), function(3valkey), function-delete(3valkey), function-flush(3valkey), function-help(3valkey), function-kill(3valkey), function-list(3valkey), function-load(3valkey), function-restore(3valkey), function-stats(3valkey), script(3valkey), script-debug(3valkey), script-exists(3valkey), script-flush(3valkey), script-help(3valkey), script-kill(3valkey), script-load(3valkey), script-show(3valkey)
like, the whole friend group. go say hi. π«ΆπΈ
okay that's the page!! this was the Valkey Command Manual, version 9.0.0, dated 2025-10-21 β mwah, perfect, no notes. now go dump those libraries bestie, you got this πβ¨π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms