
If cache is faster than database, why not store everything in cache?
We should all have had this question, why not just use cache everywhere if cache is faster than a database? I want to quantify and show the difference to you today. You are thinking, ok this read is going to be a waste of time, I am just gonna say Cache is volatile and move on to doomscroll, or vibe code or watch the latest Ai slop VC drama. Lets fix that, you have a non volatile cache and you dont have to worry about the money to make it non volatile. Can you still use Redis as your DB ? Volatility means the cache lives on RAM, when you switch it off, all the data is gone. Whereas DB lives on the disk, and it will survive restart. We can make it volatile by doing snapshot of the data to a disk, or replicating data across servers. So now that you have decided to think, can you actually make Redis your DB, given it is not volatile anymore? Problem 1: Lets talk about the easy reasoning here - COST Lets assume you own a bank, and it has the following things: 10 million total users 1 milli
Continue reading on Dev.to
Opens in a new tab

