redis 有五个基本类型:

string,hash,set,List,zset.

 

把setnx 和 expire压成一条命令(即设置过期时间)

set zhang 10 ex 100 nx  (设置key val 过期时间是100秒)

ttl zhang           (TTL key :查看过期时间)

persist zhang     (persist key:清除key的过期时间。Key持久化。)

redis 记录

 redis 记录

另外 :如果给key 重命名 (rename)了,原来expire设置的过期时间依旧存在

 

学习博客:https://www.cnblogs.com/aspirant/p/9078895.html

相关文章:

  • 2021-10-24
  • 2021-07-12
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-13
  • 2021-07-20
  • 2022-02-08
  • 2021-12-05
  • 2021-07-12
相关资源
相似解决方案