Merge branch '5.3.x'
This commit is contained in:
commit
543738ca58
|
|
@ -5587,8 +5587,8 @@ an existing Spring application. Similar to the <<data-access.adoc#transaction, t
|
|||
support, the caching abstraction allows consistent use of various caching solutions with
|
||||
minimal impact on the code.
|
||||
|
||||
As from Spring 4.1, the cache abstraction has been significantly extended with the
|
||||
support of <<cache-jsr-107,JSR-107 annotations>> and more customization options.
|
||||
In Spring Framework 4.1, the cache abstraction was significantly extended with support
|
||||
for <<cache-jsr-107,JSR-107 annotations>> and more customization options.
|
||||
|
||||
|
||||
|
||||
|
|
@ -6313,7 +6313,7 @@ up its declaration at runtime and understands its meaning. Note that, as mention
|
|||
=== JCache (JSR-107) Annotations
|
||||
|
||||
Since version 4.1, Spring's caching abstraction fully supports the JCache standard
|
||||
annotations: `@CacheResult`, `@CachePut`, `@CacheRemove`, and `@CacheRemoveAll`
|
||||
(JSR-107) annotations: `@CacheResult`, `@CachePut`, `@CacheRemove`, and `@CacheRemoveAll`
|
||||
as well as the `@CacheDefaults`, `@CacheKey`, and `@CacheValue` companions.
|
||||
You can use these annotations even without migrating your cache store to JSR-107.
|
||||
The internal implementation uses Spring's caching abstraction and provides default
|
||||
|
|
@ -6327,8 +6327,8 @@ you can switch to these standard annotations without changing your cache storage
|
|||
==== Feature Summary
|
||||
|
||||
For those who are familiar with Spring's caching annotations, the following table
|
||||
describes the main differences between the Spring annotations and the JSR-107
|
||||
counterpart:
|
||||
describes the main differences between the Spring annotations and their JSR-107
|
||||
counterparts:
|
||||
|
||||
.Spring vs. JSR-107 caching annotations
|
||||
[cols="1,1,3"]
|
||||
|
|
@ -6420,16 +6420,15 @@ invoking the method again:
|
|||
|
||||
==== Enabling JSR-107 Support
|
||||
|
||||
You need do nothing specific to enable the JSR-107 support alongside Spring's
|
||||
declarative annotation support. Both `@EnableCaching` and the
|
||||
`cache:annotation-driven` element automatically enable the JCache support
|
||||
if both the JSR-107 API and the `spring-context-support` module are present
|
||||
in the classpath.
|
||||
You do not need to do anything specific to enable the JSR-107 support alongside Spring's
|
||||
declarative annotation support. Both `@EnableCaching` and the `cache:annotation-driven`
|
||||
XML element automatically enable the JCache support if both the JSR-107 API and the
|
||||
`spring-context-support` module are present in the classpath.
|
||||
|
||||
NOTE: Depending on your use case, the choice is basically yours. You can even
|
||||
mix and match services by using the JSR-107 API on some and using Spring's own
|
||||
annotations on others. However, if these services impact the same caches,
|
||||
you should use a consistent and identical key generation implementation.
|
||||
NOTE: Depending on your use case, the choice is basically yours. You can even mix and
|
||||
match services by using the JSR-107 API on some and using Spring's own annotations on
|
||||
others. However, if these services impact the same caches, you should use a consistent
|
||||
and identical key generation implementation.
|
||||
|
||||
|
||||
|
||||
|
|
@ -6653,15 +6652,14 @@ invoked every time.
|
|||
=== Plugging-in Different Back-end Caches
|
||||
|
||||
Clearly, there are plenty of caching products out there that you can use as a backing
|
||||
store. To plug them in, you need to provide a `CacheManager` and a `Cache` implementation,
|
||||
since, unfortunately, there is no available standard that we can use instead.
|
||||
This may sound harder than it is, since, in practice, the classes tend to be simple
|
||||
https://en.wikipedia.org/wiki/Adapter_pattern[adapters] that map the caching abstraction
|
||||
framework on top of the storage API, as the `ehcache` 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). We hope that, in time, the libraries
|
||||
that provide integration with Spring can fill in this small configuration gap.
|
||||
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 https://en.wikipedia.org/wiki/Adapter_pattern[adapters] that map the
|
||||
caching abstraction framework on top of the storage API, as the `ehcache` 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). We hope
|
||||
that, in time, all relevant caches will offer JSR-107 support.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue