I want to use Redis as like a simple database. I will need 10 items at a time for each call like pagination. When client asks for 10 items after an object, I want to get those items from Redis and If there is no specific object just want to give the latest 10.
I want to use Redis to avoid excessive usage of db reads. I will keep the objects created in the last 24 hours in Redis and serve the clients from that cache.
For the sorting and having 10 from a point problem, I thought having a sorted set and have epochs as scores and then using "zrevrangebyscore". However I see that I can not expire elements of a sorted array (since I want to have objects created in the last 24 hours). If I use seperate keys for each object, I couldn't figure out the way to sort and get a number of items starting at some point.
Do you have suggestions how to design for my case?
Thanks in advance