I want to keep track of number of logins in last 5 minutes and last 60 minutes. And if the user exceeds a threshold (say 10 times in 5 minutes or 20 in 60mins) for any of these intervals, I want to perform some other action.
I have a system which notifies my code that a user has logged in and sends his/her id.
I want to keep track of number of logins in last 5 minutes and last 60 minutes. And if the user exceeds a threshold (say 10 times in 5 minutes or 20 in 60mins) for any of these intervals, I want to perform some other action.
How can I implement it using redis.
Ps: I tried getting the expiry time and setting it to new expiry time every login but that only gives me number of logins in a certain interval only.