redis PERSIST command


  Translation results:

resist

UK[rɪˈzɪst] US[rɪˈzɪst]

v. Resist, resist; endure; oppose, resist

n.Prevent Dye; preservative

Third person singular: resists Present participle: resisting Past tense: resisted Past participle: resisted

redis PERSIST commandsyntax

Function:Remove the survival time of a given key and convert this key from "volatile" (key with survival time) to "persistent" (a key without survival time, never Expired key).

Syntax: PERSIST key

Available versions: >= 2.2.0

Time complexity: O(1)

Return: When the survival time is removed successfully, return 1. If key does not exist or key does not have a survival time set, return 0.

redis PERSIST commandexample

redis> SET mykey "Hello"
OK
redis> EXPIRE mykey 10  # 为 key 设置生存时间
(integer) 1
redis> TTL mykey
(integer) 10
redis> PERSIST mykey    # 移除 key 的生存时间
(integer) 1
redis> TTL mykey
(integer) -1

Home

Videos

Q&A