Java geek
Related reading:
JAVA Basic (1) simple, thorough understanding of inner classes and static inner classes JAVA Basic (2) memory optimization – Using JAVA references to do caching JAVA Basic (3) The implementation of hot loading ClassLoader (4) The use of enumerations (enum) and constant definitions. (5) The use of factory classes. (5) The use of functional interfaces – Reuse, decouple The edge of JAVA programming. The self-registration strategy pattern satisfies the open and closed principle gracefully. HikariPool source code (two) design ideas for reference in the workplace (a) IT factory survival rules
1. 为什么是JetCache
- It integrates Caffeine and Redis, two of the more well-known open source caching tools
- The documents are more detailed and updated frequently
- Ali open source cache tool, and Ali internal also in use
- The code is less complex and easier to read
- There are test cases for easy debugging
2. Look at the source code with the cache knowledge
As a caching tool, JetCache should have the ability of caching tools, and at the same time, it should be able to solve the common problems of caching, with the cache related knowledge to see the source of JetCache, and compare the knowledge, so the harvest is greater. The core knowledge of caching is as follows:
2.1. Cache Application Scenarios
The application scenarios of caching are as follows:
2.2. Cache classification
2.2.1. Scope classification
The scope of the cache can be divided into:
The thread-level cache contains data in Java that corresponds to a ThreadLocal store.
The process-level cache, as in JAVA, stores data corresponding to static variables.
2.2.2. Java Cache classification
Caches in Java fall into three categories:
For a host with memory constraints, you can set the cache that is not frequently accessed to a soft or weak reference cache and automatically reclaim memory when needed.
2.3. Cache design
Cache design considerations include:
2.4. Common Problems
When using or developing a caching tool, consider whether common caching issues can be addressed, including:
2.4. Open source frameworks
There are many open source frameworks for caching. When time and energy are limited, focus on a few mainstream ones first, and then go to the others when you have time or need to go to caching experts. Now you can familiarize yourself with the following:
end.