RESTORE key ttl serialized-value [ replace ] [ absttl ] [ IDLETIME seconds ] [ FREQ frequency ]
O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).

Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via DUMP).

If ttl is 0 the key is created without any expire, otherwise the specified expire time (in milliseconds) is set.

If the ABSTTL modifier was used, ttl should represent an absolute Unix timestamp (in milliseconds) in which the key will expire.

For eviction purposes, you may use the IDLETIME or FREQ modifiers. See OBJECT for more information.

!RESTORE will return a "Target key name is busy" error when key already exists unless you use the REPLACE modifier.

!RESTORE checks the RDB version and data checksum. If they don't match an error is returned.

Examples> DEL mykey
(integer) 0> RESTORE mykey 0 "\n\x17\x17\x00\x00\x00\x12\x00\x00\x00\x03\x00\
OK> TYPE mykey
list> LRANGE mykey 0 -1
1) "1"
2) "2"
3) "3"


Version Change

Added the REPLACE modifier.


Added the ABSTTL modifier.


Added the IDLETIME and FREQ options.