Redis Keys: RESTORE
Redis RESTORE Command
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.
Here are some common uses and scenarios for the "RESTORE" command:
- Backup Restoration: Restore data from a backup or serialized form.
- Import Data: Import previously exported data into Redis.
- Migration: Transfer data between Redis instances using serialized data.
- Historical Data: Revert keys to previous states using serialized backups.
Syntax:
RESTORE key 0 "serialized value"
Available since
2.6.0.
Return Value
Simple string reply: The command returns OK on success.
Return Value Type
String
Example: Redis RESTORE
First, create some keys in redis and set some values in it.
127.0.0.1:6379> SET key "Apple" OK 127.0.0.1:6379> Dump key "\x00\x05Apple\x06\x00\r\x88\x03\xb7\x96\x16\xf6p" 127.0.0.1:6379> DEL key (integer) 1 127.0.0.1:6379> restore key 0 "\x00\x05Apple\x06\x00\r\x88\x03\xb7\x96\x16\xf6p" OK 127.0.0.1:6379> GET key "Apple"
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/redis/redis-restore-key.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics