RESTORE

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Restore data

Simple usage: RESTORE key 0 "serialized value".
The "serialized value" is the value obtained with DUMP.
After the key you can specify an expire time in milliseconds. 0 means no expire time.
The REPLACE option overwrites the key if it already exists.

Example

Command>set key a
Result>OK
Command>dump key
Result>"\x00\x01a\x06\x00)\x13\x87\x1bzcA'"
Command>del key
Result>1
Command>restore key 0 "\x00\x01a\x06\x00)\x13\x87\x1bzcA'"
Result>OK
Command>get key
Result>a


Syntax

RESTORE key ttl serialized-value [REPLACE]

  • Available since version 2.6.0.
  • Time complexity is O(1).
  • From 6.0, event notification is emitted -> 'restore'
Related commands DUMP, MIGRATE
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< DUMP RESTORE MIGRATE >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.