You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc
+60-1Lines changed: 60 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,8 @@ This section defines the settings which control this behavior.
25
25
26
26
`org.hibernate.cache.spi.RegionFactory` defines the integration between Hibernate and a pluggable caching provider.
27
27
`hibernate.cache.region.factory_class` is used to declare the provider to use.
28
-
Hibernate comes with built-in support for two popular caching libraries: <<caching-provider-ehcache,Ehcache>> and <<caching-provider-infinispan,Infinispan>>.
28
+
Hibernate comes with built-in support for the Java caching standard <<caching-provider-jcache,JCache>>
29
+
and also two popular caching libraries: <<caching-provider-ehcache,Ehcache>> and <<caching-provider-infinispan,Infinispan>>.
29
30
Detailed information is provided later in this chapter.
Use of the build-in integration for https://jcp.org/en/jsr/detail?id=107[JCache] requires that the `hibernate-jcache` module jar (and all of its dependencies) are on the classpath.
472
+
In addition a JCache implementation needs to be added as well.
473
+
A list of compatible implementations can be found https://jcp.org/aboutJava/communityprocess/implementations/jsr107/index.html[on the JCP website].
474
+
An alternative source of compatible implementations can be found through https://github.com/cruftex/jsr107-test-zoo[the JSR-107 test zoo].
475
+
====
476
+
477
+
[[caching-provider-jcache-region-factory]]
478
+
==== RegionFactory
479
+
480
+
The `hibernate-jcache` module defines the following region factory: `JCacheRegionFactory`.
481
+
482
+
To use the `JCacheRegionFactory`, you need to specify the following configuration property:
The `JCacheRegionFactory` configures a `javax.cache.CacheManager`.
496
+
497
+
[[caching-provider-jcache-cache-manager]]
498
+
==== JCache `CacheManager`
499
+
500
+
JCache mandates that `CacheManager`{empty}s sharing the same URI and class loader be unique in JVM.
501
+
502
+
If you do not specify additional properties, the `JCacheRegionFactory` will load the default JCache provider and create the default `CacheManager`.
503
+
Also, `Cache`{empty}s will be created using the default `javax.cache.configuration.MutableConfiguration`.
504
+
505
+
In order to control which provider to use and specify configuration for the `CacheManager` and `Cache`{empty}s you can use the following two properties:
Only by specifying the second property `hibernate.javax.cache.uri` will you be able to have a `CacheManager` per `SessionFactory`.
465
522
466
523
[[caching-provider-ehcache]]
467
524
=== Ehcache
468
525
526
+
This integration covers Ehcache 2.x, in order to use Ehcache 3.x as second level cache, refer to the <<caching-provider-jcache,JCache integration>>.
527
+
469
528
[NOTE]
470
529
====
471
530
Use of the build-in integration for http://www.ehcache.org/[Ehcache] requires that the `hibernate-ehcache` module jar (and all of its dependencies) are on the classpath.
0 commit comments