Plugging-in Different Back-end Caches

显然,有很多缓存产品可用作备用存储。对于不支持 JSR-107 的产品,您需要提供一个 CacheManager 和一个 Cache 实现。这可能听起来比实际情况更难,因为实际上,这个类倾向于成为 @{11},它将缓存抽象框架映射到存储 API 的顶层,就像 Caffeine 类一样。大多数 CacheManager 类可以使用 org.springframework.cache.support 包中的类(例如 AbstractCacheManager,它处理样板代码,只留下实际映射需要完成)。

Clearly, there are plenty of caching products out there that you can use as a backing store. For those that do not support JSR-107 you need to provide a CacheManager and a Cache implementation. This may sound harder than it is, since, in practice, the classes tend to be simple adapters that map the caching abstraction framework on top of the storage API, as the Caffeine classes do. Most CacheManager classes can use the classes in the org.springframework.cache.support package (such as AbstractCacheManager which takes care of the boiler-plate code, leaving only the actual mapping to be completed).