How to get callback when key expires in REDIS

前端 未结 2 2063
伪装坚强ぢ
伪装坚强ぢ 2020-12-25 13:39

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

相关标签:
2条回答
  • 2020-12-25 14:07

    There are no such callbacks in redis (not that I know of).

    I would do it like this:

    • when user signs up, put his id into a sorted set where the score is a timestamp (now + 4 days) and member is user id.
    • have a periodic job that gets all records from that sorted set where timestamp is in the past.
    • loop through those user ids and take actions (if he didn't confirm - delete all user's data).
    0 讨论(0)
  • 2020-12-25 14:22

    This feature implemented in Redis 2.8, read about it here http://redis.io/topics/notifications

    0 讨论(0)
提交回复
热议问题