{
  "schema_version": 2,
  "id": "commands/restore",
  "title": "RESTORE",
  "url": "https://redis.io/docs/latest/commands/restore/",
  "summary": "Creates a key from the serialized representation of a value.",
  "since": "2.6.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:32+01:00",
  "page_type": "content",
  "content_hash": "0c2d05219608e7d0d54f78b8bb4e6050545376b6ae5258846a349704dbfc1745",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Create a key associated with a value that is obtained by deserializing the\nprovided serialized value (obtained via [`DUMP`](https://redis.io/docs/latest/commands/dump)).\n\nIf `ttl` is 0 the key is created without any expire, otherwise the specified\nexpire time (in milliseconds) is set.\n\nIf the `ABSTTL` modifier was used, `ttl` should represent an absolute\n[Unix timestamp](http://en.wikipedia.org/wiki/Unix_time) (in milliseconds) in which the key will expire.\n\nFor eviction purposes, you may use the `IDLETIME` or `FREQ` modifiers. See\n[`OBJECT`](https://redis.io/docs/latest/commands/object) for more information.\n\n`RESTORE` will return a \"Target key name is busy\" error when `key` already\nexists unless you use the `REPLACE` modifier.\n\n`RESTORE` checks the RDB version and data checksum.\nIf they don't match an error is returned."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key to create.\n\n</details>\n\n<details open><summary><code>ttl</code></summary>\n\nThe time to live for the key, in milliseconds. `0` means no expiration. With `ABSTTL`, this is an absolute Unix timestamp in milliseconds.\n\n</details>\n\n<details open><summary><code>serialized-value</code></summary>\n\nThe serialized value, as produced by `DUMP`.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>REPLACE</code></summary>\n\nReplace the key if it already exists.\n\n</details>\n\n<details open><summary><code>ABSTTL</code></summary>\n\nInterpret `ttl` as an absolute Unix timestamp in milliseconds rather than a relative time.\n\n</details>\n\n<details open><summary><code>IDLETIME seconds</code></summary>\n\nSet the key's idle time (for LRU eviction) to this many seconds.\n\n</details>\n\n<details open><summary><code>FREQ frequency</code></summary>\n\nSet the key's access-frequency counter (for LFU eviction) to this value.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Not supported\">&#x274c; Active-Active\\*</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Not supported\">&#x274c; Active-Active\\*</nobr></span> | \\*Only supported for module keys. |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.\n\n**RESP3:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "redis> DEL mykey\n0\nredis> RESTORE mykey 0 \"\\n\\x17\\x17\\x00\\x00\\x00\\x12\\x00\\x00\\x00\\x03\\x00\\\n                        x00\\xc0\\x01\\x00\\x04\\xc0\\x02\\x00\\x04\\xc0\\x03\\x00\\\n                        xff\\x04\\x00u#<\\xc0;.\\xe9\\xdd\"\nOK\nredis> TYPE mykey\nlist\nredis> LRANGE mykey 0 -1\n1) \"1\"\n2) \"2\"\n3) \"3\"",
      "section_id": "examples"
    }
  ]
}
