When should caching be used?

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.

+4
source share
1 answer

I use it apache-igniteas a cache, where I store only the most accessible data, such as reporting objects, in your case there may be recently added articles (you need to make this decision).

Depending on your hardware, because light or any cache, store the data in RAM so that you think about this aspect when you decide what to do in the cache.

, , , , , createDate , .

Ignite ORM, , : .

0

Source: https://habr.com/ru/post/1616335/


All Articles