key_name = 'test_h'
redis.expire(key_name, -1)
redis.execute()
redis中这个键直接被销毁了,为什么??
key_name = 'test_h'
redis.expire(key_name, -1)
redis.execute()
redis中这个键直接被销毁了,为什么??
2 回答5.1k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
4 回答973 阅读✓ 已解决
3 回答1.1k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
1 回答1.7k 阅读✓ 已解决
1 回答1.2k 阅读✓ 已解决
python函数是对命令的包装,直接看文档示例
可以看到删除key时的过期时间就是-1
再看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
意思就是不设置过期时间则永不过期