Spring Cache

This is the manual for older MicroStream versions (Version < 5.0).
The new documentation (Version >= 5.0) is located at:
First of all add the MicroStream Cache dependency:
The core caching abstraction provided by Spring comes in the spring-context module.
If you use Spring Boot, then add the spring-boot-starter-cache package to add the caching dependencies:
To enable caching, Spring makes good use of annotations, much like enabling any other configuration level feature in the framework. The caching feature can be enabled by simply providing a cache setup component.
public class MyApplication
public class CachingSetup implements JCacheManagerCustomizer
public void customize(CacheManager cacheManager)
cacheManager.createCache("my_cache", new MutableConfiguration<>()
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(SECONDS, 10000)))