I'm designing an ASP.net core system that deals with objects having an expiry date (2 days OR 1-3 months). Once this expiry date reached, expired objects should be removed.
We are using SQL + a Cron job to remove old items. That's not really efficient and we need to maintain the associated code.
I was considering using Redis for that purpose. However I'm not sure a recommended approach. Redis not persist the data so if we reboot the server we loose everything.
Any other approach?
Most Cache solutions with a built in TTL (Time to Live) will most likely work for you.
Redis does have persistence options that will preserve your data during a restart.
Have a look at - https://redis.io/commands/ttl and https://redis.io/topics/persistence