如何在 REDIS 中的密钥过期时获得回调 [英] How to get callback when key expires in REDIS
问题描述
我正在使用 Bottle 开发应用程序.在我的注册表中,我使用唯一的密钥通过邮件确认电子邮件.我将此密钥存储在 REDIS 中,有效期为 4 天.如果用户在 4 天内未确认电子邮件,密钥将过期.为此,我想从我的数据库 (mongoDB) 中永久删除用户条目.
I'm developing application using Bottle. In my registration form, I'm confirming email by mail with a unique key. I'm storing this key in REDIS with expiry of 4 days. If user does not confirm email within 4 days, key gets expired. for this, I want to permanently delete the user entry from my database(mongoDB).
当然,我不需要持续轮询我的 redis 服务器来检查密钥是否存在.
Ofcourse I dont require continous polling to my redis server to check whether key exists or not.
有什么办法可以得到Redis的回调吗??
Is there any way to get a callback from Redis??
或者还有其他有效的方法吗?
OR is there any other efficient way?
推荐答案
此功能在 Redis 2.8 中实现,请在此处阅读 http://redis.io/topics/notifications
This feature implemented in Redis 2.8, read about it here http://redis.io/topics/notifications
这篇关于如何在 REDIS 中的密钥过期时获得回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!