diff --git a/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc b/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc index 1ddde1502b..802a861326 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc @@ -64,6 +64,16 @@ Besides specific provider configuration, there are a number of configurations op the alternative is to have stale data in that collection cache. `hibernate.cache.use_reference_entries`:: Enable direct storage of entity references into the second level cache for read-only or immutable entities. +`hibernate.cache.keys_factory`:: + When storing entries into second-level cache as key-value pair, the identifiers can be wrapped into tuples + to guarantee uniqueness in case that second-level cache stores all entities + in single space. These tuples are then used as keys in the cache. When the second-level cache implementation + (incl. its configuration) guarantees that different entity types are stored separately and multi-tenancy is not + used, you can omit this wrapping to achieve better performance. This hint can be ignored by the second-level + cache implementation, though. Valid values are: +* `default` (wraps identitifers in the tuple) +* `simple` (uses identifiers as keys without any wrapping) +* fully qualified class name that implements `org.hibernate.cache.spi.CacheKeysFactory` [[caching-mappings]] === Configuring second-level cache mappings diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 775984a162..66a896d92b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -682,6 +682,8 @@ public interface AvailableSettings { *
  • an Object implementing {@link org.hibernate.cache.spi.CacheKeysFactory}
  • *
  • a Class implementing {@link org.hibernate.cache.spi.CacheKeysFactory}
  • *
  • FQN of a Class implementing {@link org.hibernate.cache.spi.CacheKeysFactory}
  • + *
  • 'default' as a short name for {@link org.hibernate.cache.internal.DefaultCacheKeysFactory}
  • + *
  • 'simple' as a short name for {@link org.hibernate.cache.internal.SimpleCacheKeysFactory}
  • * * * @since 5.0.10 - note that currently this is only honored for hibernate-infinispan