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).
Ofcourse I dont require continous polling to my redis server to check whether key exists or not.
Is there any way to get a callback from Redis??
OR is there any other efficient way?
According to Redis documentation, the SET command removes the TTL because the key is overwritten. However you can use the EVAL command to evaluate a Lua script to do it automatically for you.
After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is often said to be volatile in Redis terminology. The timeout will only be cleared by commands that delete or overwrite the contents of the key, including DEL , SET , GETSET and all the *STORE commands.
Redis keyspace notifications allow you to subscribe to PubSub channels. Through the channel, clients receive published events when a Redis command or data alteration occurs. These notifications are useful when an application must respond to changes that occur to the value stored in a particular key or keys.
This feature implemented in Redis 2.8, read about it here http://redis.io/topics/notifications
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With