Introduction
To provide transparent cachning functionality, Spring introduces the Cache abstraction. The goal is to allow consistent use of caching with minimal impact on the code.
-
Applies caching to Java methods
- Method result is cached if needed
- Method should return the same output
-
Reducing number of method executions
- Was method already invoked with given arguments?
-
Spring provides abstraction, so it requires Cache implementation (backing cache)
-
Spring has no special handling for multi-threaded code
-
To use caching you need to:
- Declare what should be cached - Cachnig declaration
- Backing cache - Cache configuration where the data is stored