Redis:是否可以使数组或排序集中的元素过期? [英] Redis: possible to expire an element in an array or sorted set?

查看:66
本文介绍了Redis:是否可以使数组或排序集中的元素过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前是否只能使整个键/值对失效?如果我想向列表类型结构中添加值并在插入后1小时自动删除它们该怎么办。目前是否可行,还是需要运行cron作业以手动进行清除?

Is it currently only possible to expire an entire key/value pair? What if I want to add values to a List type structure and have them get auto removed 1 hour after insertion. Is that currently possible, or would it require running a cron job to do the purging manually?

推荐答案


目前是否只能使整个键/值对失效?

Is it currently only possible to expire an entire key/value pair?

据我所知,并且根据到期的href = http://redis.io/commands#generic>密钥命令和文档您只能将过期设置为特定键,而不能设置为基础数据结构。但是,在Google网上论坛上有关于此功能的讨论,其中概述了替代解决方案。

As far as I know, and also according to key commands and document about expiration, currently you can set expiration only to specific key and not to it's underlying data structure. However there is a discussion on google groups about this functionality with outlined alternative solutions.

这篇关于Redis:是否可以使数组或排序集中的元素过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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