FUNCTION-DUMP(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’… 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