簡體   English   中英

是否可以為Redis中的所有鍵設置默認的ttl?

[英]Is it possible to set default ttl for all keys in redis?

我已經閱讀過redis config 文檔,但是找不到這樣的選項。

我搜索后發現,“默認情況下,密鑰將永遠存在”。 我想急於更改此默認行為。

Normally Redis keys are created without an associated time to live. The key will simply live forever, unless it is removed by the user in an explicit way, for instance using the DEL command. 
The EXPIRE family of commands is able to associate an expire to a given key, at the cost of some additional memory used by the key. When a key has an expire set, Redis will make sure to remove the key when the specified amount of time elapsed.

http://redis.io/commands/expire (again)

提前致謝 !

Redis不提供此功能-您必須為每個鍵顯式設置一個TTL。 請注意,更新密鑰會重置其TTL,因此您必須相應地對其進行重新設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM