RESTORE

Since 1.1.0Keys

Syntax

RESTORE key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME seconds] [FREQ frequency]
  • Flags: write
  • ACL categories: @dangerous, @generic, @keyspace, @slow, @write
  • Arity: -4

Creates key from a DUMP payload. ttl is in milliseconds, 0 for no expiry.

Options

OptionEffect
REPLACEReplace key if it exists.
ABSTTLttl is a Unix time in milliseconds, not a duration.
IDLETIME seconds, FREQ frequencyAccepted for compatibility with Redis; only one of the two can be given.

Reply

  • OK.
  • BUSYKEY Target key name already exists. if key exists and REPLACE was not given.
  • ERR DUMP payload version or checksum are wrong if the payload is damaged, or not KiviDB's.

Examples

> SET src hello
OK
> DUMP src
"\x01\x05\x00\x00\x00hello..."
> RESTORE copy 0 "\x01\x05\x00\x00\x00hello..."
OK
> GET copy
"hello"
> RESTORE copy 5000 "\x01\x05..." REPLACE
OK
> PTTL copy
(integer) 5000