-
Notifications
You must be signed in to change notification settings - Fork 1.6k
JCache
JSR-107 JCache is a standardized caching API that is Java 6 compatible and introduced in JEE 8. Caffeine provides a local in-memory implementation. The JCache provider is configured using Typesafe's Config library. See the reference.conf for more details.
Be weary of anonymous caches, which are created using the specification's defaults settings. This means a cache that never expires and stores by value (serialization). Prefer instead replacing the DefaultCacheResolverFactory binding to create an anonymous cache using Caffeine's defaults or disallows creating them. This ensures that your desired default behavior, rather than the specification's, are honored.
See the Spring documentation.
Prefer using Spring Cache, which includes support for Caffeine as of Spring Framework 4.3 and Spring Boot 1.4.
The JSR provides an integration module that delegates to the JCache provider.
compile 'org.jsr107.ri:cache-annotations-ri-guice:1.0.0'
Injector injector = Guice.createInjector(new CacheAnnotationsModule());
The JSR provides an extension that delegates to the JCache provider.
compile 'org.jsr107.ri:cache-annotations-ri-cdi:1.0.0'