FUNCTION RESTORE
FUNCTION RESTORE serialized-value [FLUSH | APPEND | REPLACE]
- Group
- Scripting and functions
- Complexity
- O(N) where N is the number of libraries
- Arity
- -3 (at least 3 words, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
FUNCTION RESTORE loads the libraries in a payload made by
FUNCTION DUMP. It is all or nothing: if any library
fails to load, the libraries that were loaded before the command are put back
and nothing changes.
Options
Section titled “Options”| Policy | Effect |
|---|---|
APPEND |
Add the payload’s libraries. Fails if any of them is already loaded. This is the default. |
REPLACE |
Add the payload’s libraries, replacing loaded libraries of the same name. |
FLUSH |
Delete all loaded libraries first, then load the payload’s. |
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Restored | Simple string OK |
Simple string OK |
Errors:
ERR Library <name> already existswithAPPENDwhen a library in the payload is already loaded.ERR Wrong restore policy given, value should be either FLUSH, APPEND or REPLACE.- Any FUNCTION LOAD error for a library in the payload.
Examples
Section titled “Examples”127.0.0.1:6379> FUNCTION DUMP"#!lua name=util\nredis.register_function('echo', function(keys, args) return args[1] end)\x00"127.0.0.1:6379> FUNCTION FLUSHOK127.0.0.1:6379> FUNCTION RESTORE "#!lua name=util\nredis.register_function('echo', function(keys, args) return args[1] end)\x00"OK127.0.0.1:6379> FCALL echo 0 "back""back"Compatibility
Section titled “Compatibility”Same policies and replies as Redis 7 and Valkey 8, but only HotKV payloads are accepted (see FUNCTION DUMP).
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.