Spring cache has come into action since the Spring 3.1 versions. Spring has also added annotations to support the caching mechanism. The caching abstraction layer provides a lot of support to use different caching solutions. In this chapter, we shall explore Spring caching. We shall see how to set up a Spring cache. You can ideally tie your caching code with a business logic.
Caching avoids re-computing. Ideally, you don't have to repeat the same process again to fetch the same values. Cache stores the values in the memory. You can always choose what you would like to cache and what you don't like to. It's a part of architectural design. Once the data is cached, it's retrieved from the cached memory, thus saving computational time.