I am using Redis solely as a cache server, so both RDB & AOF are turned off as I already have a DB in place and having 2 layers that do the same thing is an overkill.
While this setup works perfectly when the DB is the only source of truth, my question is more about what happens when you use Redis to keep tracking of things like game scores, pages views, analytics from a webhook, etc..
As of now, we don't have any persistence for Redis, it means that if the server crash/restart all those data are gone.
so what would be the best way to keep the DB in-sync with the Redis data?
maybe set up a cron job that gets the data from Redis every 1 min and updates the DB.
maybe instead of interrupting Redis every min because of its single-threaded nature & to avoid any data miss, we can add the data to a queue that runs when the size = 50 or something, which then updates the DB
I'm using laravel so any examples following its ecosystem are appreciated, but also any thoughts are very welcomed.