Redis Keys: Restore

RESTORE key ttl serialized-value [REPLACE]

The Redis RESTORE command is used to 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 key 0 "serialized value"

Available since


Return Value

Simple string reply: The command returns OK on success.

Return Value Type


Example: Redis RESTORE

First, create some keys in redis and set some values in it.> SET key "Apple"
OK> Dump key
"\x00\x05Apple\x06\x00\r\x88\x03\xb7\x96\x16\xf6p"> DEL key
(integer) 1> restore key 0 "\x00\x05Apple\x06\x00\r\x88\x03\xb7\x96\x16\xf6p"
OK> GET key

Previous: RENAMENX
Next: SCAN

Follow us on Facebook and Twitter for latest update.