Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试为 ioredis nodejs 中的一组值设置过期时间。我可以使用此命令将一组添加到 reids
redis.sadd('set', 1, 3, 5, 7);
但是我需要为这个集合设置一个过期时间。我怎样才能做到这一点?
您可以使用过期
redis.expire('set', 10);
expire 的一般语法是EXPIRE KEY_NAME TIME_IN_SECONDS.
EXPIRE KEY_NAME TIME_IN_SECONDS
有多种方法可以做到这一点,只有当您想尝试其他方法时。