讨论数量:
这是正常的,官网手册已经说的很明确了:
Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successful SET operation.
如果你想保留与 key 关联的生存时间,可使用 KEEPTTL
选项,从 Redis 版本 6.0.0 开始添加了该选项
推荐文章: