How to use Redis for checking availablity of a person

Viewed 318

Lets consider a meeting request where i can find if a person is available in a particular time slot.

Example: I need to check if person is available for meeting from 3 to 3:30. So if a person is busy from 2:30 to 3:01 means person is unavailable.

Question: how can i use the redis cache here. Do i need to store cache of every minute of a user and can then application decides or any other way ?

1 Answers

I'm not sure if Redis is the data store that I'd choose for this task.

Still, if you're willing to work in a 1 minute resolution then you could store the minutes in which a person is occupied inside a Sorted Set of minutes, and then check if a time range overlaps that person's scheduled appointments with the ZINTER command.

Related