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

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

问题描述

目前是否只能使整个键/值对过期?如果我想将值添加到 List 类型结构并在插入后 1 小时自动删除它们,该怎么办.这是目前可能的,还是需要运行 cron 作业来手动进行清除?

解决方案

目前是否只能使整个键/值对过期?

据我所知,也根据key命令和关于expiration,目前您只能将过期设置为特定的键,而不是它的底层数据结构.但是,在 Google 群组上有一个关于此功能的讨论,并提供了概述的替代解决方案.>

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?

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天全站免登陆