如何“过期"“HSET"redis中的子键? [英] How to "EXPIRE" the "HSET" child key in redis?

查看:22
本文介绍了如何“过期"“HSET"redis中的子键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使 redis 哈希中的所有密钥过期,这些密钥超过 1 个月.

I need to expire all keys in redis hash, which are older than 1 month.

推荐答案

这是不可能,为了保持Redis简单.

Redis 的创建者 Quoth Antirez:

Quoth Antirez, creator of Redis:

这是不可能的,或者为此使用不同的顶级密钥特定字段,或与归档的另一个字段一起存储过期时间,获取两者,并让应用程序了解它是否是根据当前时间仍然有效.

Hi, it is not possible, either use a different top-level key for that specific field, or store along with the filed another field with an expire time, fetch both, and let the application understand if it is still valid or not based on current time.

这篇关于如何“过期"“HSET"redis中的子键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆