Back to Redis

PERSIST

content/commands/persist.md

latest1.4 KB
Original Source

Remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).

Examples

{{% redis-cli %}} SET mykey "Hello" EXPIRE mykey 10 TTL mykey PERSIST mykey TTL mykey {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="persist-return-info" tab1="RESP2" tab2="RESP3" >}}

One of the following:

  • Integer reply: 0 if key does not exist or does not have an associated timeout.
  • Integer reply: 1 if the timeout has been removed.

-tab-sep-

One of the following:

  • Integer reply: 0 if key does not exist or does not have an associated timeout.
  • Integer reply: 1 if the timeout has been removed.

{{< /multitabs >}}