The concept of caching is to temporarily store data that makes accessing it faster. Caching is employed to help save on the use of resources. When we retrieve data, it should be made available for future requests for the same data. Implementing this saves on the processing time required for continual retrieval of the same data.
The next diagram provides a conceptual view of how caching is architected into a system. As you can see, there are several caches and a cache-management system that controls what is in a cache and how it is accessed. The diagram illustrates how redundancy can also be built into a caching system:
There is no single method of implementing caching in Java. In the next section, we will review one possible approach for implementing this design pattern.