I am building a website based on a MySQL database. The website will have many tables, many rows, and many views. I know, because I am creating a new system for an existing website.
The current website uses only MySQL, without caching, and this causes many problems, such as poor performance and database crashes.
In the new system, I would like to avoid this using a caching mechanism such as Redis, but the real problem is that I do not quite understand what data should be cached or in what cases.
Should I cache:
- Everything?
- Large / small tables?
- All data / only part of it?
How to use caching?
- Store all data in MySQL and cache only some records? (example: latest articles)
- Save some data only on Redis? (example: viewing articles / table of IP addresses)
I don’t want you to directly answer my question, I just need a guide to use caching.
source
share