Luke Melia ยป Redis in Practice: Who’s Online?
The idea is to have one active set per minute. During each request that comes in from a logged-in user, we’ll add a user ID to the active set. When we want to know which user IDs are online, we can union the last 5 sets to get a collection of user IDs who have made a request in the last 5 minutes.
Implementing a scalable ‘who’s online’ service with Redis