修改本页

Redis 命令 客户端 文档 社区 下载 问题 支持 许可

RESTORE key ttl serialized-value

相关命令

Available since 2.6.0.

时间复杂度: O(1) to create the new key and additional O(NM) to recostruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1M) where M is small, so simply O(1). However for sorted set values the complexity is O(NMlog(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.

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

返回值

Simple string reply: The command returns OK on success.

例子

  1. redis> DEL mykey
  2. 0
  3. redis> RESTORE mykey 0 "\n\x17\x17\x00\x00\x00\x12\x00\x00\x00\x03\x00\
  4. x00\xc0\x01\x00\x04\xc0\x02\x00\x04\xc0\x03\x00\
  5. xff\x04\x00u#<\xc0;.\xe9\xdd"
  6. OK
  7. redis> TYPE mykey
  8. list
  9. redis> LRANGE mykey 0 -1
  10. 1) "1"
  11. 2) "2"
  12. 3) "3"

Comments powered by Disqus

This website is open source software developed by Citrusbyte.

The Redis logo was designed by Carlos Prioglio. See more credits.

Sponsored by Redis Support