RESTORE key ttl serialized-value [REPLACE]

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.

RESTORE will return a "Target key name is busy" error when key already exists unless you use the REPLACE modifier (Redis 3.0 or greater).

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

*Return value

Simple string reply: The command returns OK on success.


redis> DEL mykey
redis> RESTORE mykey 0 "\n\x17\x17\x00\x00\x00\x12\x00\x00\x00\x03\x00\
redis> TYPE mykey
redis> LRANGE mykey 0 -1
1) "1"
2) "2"
3) "3"