Introduction to caching

1. The role of cache

Java caching technology is an intermediate layer between the application and the database, used to store temporary data, especially data that is frequently read but rarely updated. Its role is to reduce the burden between the application and the database and improve the response speed and performance of the application.

2. Use of cache

1. Data scenarios suitable for caching

(1) Those with low requirements on immediacy and data consistency.

(2) Data with high access volume and low update frequency (more reads, less writes).

2. Read cache flow chart

Insert image description here

3. Local cache and distributed cache

Local cache: suitable for single-machine situations (distributed situations may cause data inconsistency problems).
Insert image description here

Distributed cache: can solve the problems of local cache (using cache middleware: redis, etc.).
Insert image description here

Guess you like

Origin blog.csdn.net/twotwo22222/article/details/132967422