我已经阅读了 redis 配置文档,但找不到这样的选项。
我搜索并发现“默认情况下,密钥将永远存在”。我想急切地改变这种默认行为。
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)
Run Code Online (Sandbox Code Playgroud)
提前致谢 !
| 归档时间: |
|
| 查看次数: |
4581 次 |
| 最近记录: |