PERSIST

Syntax

  1. PERSIST key

Time complexity: O(1)

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).

Return

Integer reply, specifically:

  • 1 if the timeout was removed.
  • 0 if key does not exist or does not have an associated timeout.

Examples

  1. dragonfly> SET mykey "Hello"
  2. "OK"
  3. dragonfly> EXPIRE mykey 10
  4. (integer) 1
  5. dragonfly> TTL mykey
  6. (integer) 10
  7. dragonfly> PERSIST mykey
  8. (integer) 1
  9. dragonfly> TTL mykey
  10. (integer) -1