Interface CacheSettings
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringDeprecated.static final StringTheRegionFactoryimplementation, either: a short strategy name, for example,jcacheorinfinispan, an instance ofRegionFactory, aClassobject representing a class that implementsRegionFactory, or the name of a class implementingRegionFactory.static final StringTheCacheProviderregion name prefixstatic final StringEntity cache configuration properties follow the patternhibernate.classcache.packagename.ClassName usage[, region]whereusageis the cache strategy used andregionthe cache region namestatic final StringCollection cache configuration properties follow the patternhibernate.collectioncache.packagename.ClassName.role usage[, region]whereusageis the cache strategy used andregionthe cache region namestatic final StringSpecifies theCacheConcurrencyStrategyto use by default when an entity is marked@Cacheable, but no concurrency strategy is explicitly specified via theCacheannotation.static final StringSpecifies theSharedCacheMode.static final StringSet a default value forSpecHints.HINT_SPEC_CACHE_RETRIEVE_MODE, used when the hint is not explicitly specified.static final StringSet a default value forSpecHints.HINT_SPEC_CACHE_STORE_MODE, used when the hint is not explicitly specified.static final StringDeprecated.UseJAKARTA_SHARED_CACHE_MODEinsteadstatic final StringDeprecated.UseJAKARTA_SHARED_CACHE_RETRIEVE_MODEinsteadstatic final StringDeprecated.UseJAKARTA_SHARED_CACHE_STORE_MODEinsteadstatic final StringSpecifies theTimestampsCacheFactoryto use.static final StringSpecifies the defaultCacheLayoutto use for the query cache.static final StringEnable direct storage of entity references into the second level cache when applicable.static final StringOptimize interaction with the second-level cache to minimize writes, at the cost of an additional read before each write.static final StringEnable the query results cachestatic final StringWhen enabled, specifies that the second-level cache may be used.static final StringEnables the use of structured second-level cache entries.
-
Field Details
-
JAKARTA_SHARED_CACHE_MODE
Specifies theSharedCacheMode.Hibernate is designed to be used with
ENABLE_SELECTIVE, and we strongly discourage the use ofALLorDISABLE_SELECTIVE, since in any multiuser system a cache is always a potential source of bugs which are difficult to isolate and reproduce. Caching should never be turned on "by accident".Setting the shared cache mode to
SharedCacheMode.NONEhas very nearly the same effect as disabling the second-level cache, globally suppressing every occurrence of theCacheableandCacheannotations.- See Also:
- Default Value:
ENABLE_SELECTIVE
-
JAKARTA_SHARED_CACHE_RETRIEVE_MODE
Set a default value forSpecHints.HINT_SPEC_CACHE_RETRIEVE_MODE, used when the hint is not explicitly specified.It does not usually make sense to change the default from
CacheRetrieveMode.USE.- See Also:
- Default Value:
USE
-
JAKARTA_SHARED_CACHE_STORE_MODE
Set a default value forSpecHints.HINT_SPEC_CACHE_STORE_MODE, used when the hint is not explicitly specified.It does not usually make sense to change the default from
CacheStoreMode.USE.- See Also:
- Default Value:
USE
-
USE_SECOND_LEVEL_CACHE
When enabled, specifies that the second-level cache may be used.By default, if the configured
RegionFactoryis not theNoCachingRegionFactory, then the second-level cache is enabled. Otherwise, the second-level cache is disabled.- See Also:
- Default Value:
truewhen a provider is specified;falseotherwise.
-
USE_QUERY_CACHE
Enable the query results cache- See Also:
- Default Value:
false
-
QUERY_CACHE_LAYOUT
Specifies the defaultCacheLayoutto use for the query cache.- Since:
- 6.5
- See Also:
-
CACHE_REGION_FACTORY
TheRegionFactoryimplementation, either:- a short strategy name, for example,
jcacheorinfinispan, - an instance of
RegionFactory, - a
Classobject representing a class that implementsRegionFactory, or - the name of a class implementing
RegionFactory.
- See Also:
- API Note:
- The term
"class"appears in the setting name due to legacy reasons; however it can accept instances. - Default Value:
NoCachingRegionFactory, so that caching is disabled.
- a short strategy name, for example,
-
QUERY_CACHE_FACTORY
Specifies theTimestampsCacheFactoryto use.- See Also:
-
CACHE_REGION_PREFIX
TheCacheProviderregion name prefix- See Also:
-
DEFAULT_CACHE_CONCURRENCY_STRATEGY
Specifies theCacheConcurrencyStrategyto use by default when an entity is marked@Cacheable, but no concurrency strategy is explicitly specified via theCacheannotation.An explicit strategy may be specified using
@Cache(usage=...).- See Also:
- Default Value:
- The cache provider's default strategy
-
USE_MINIMAL_PUTS
Optimize interaction with the second-level cache to minimize writes, at the cost of an additional read before each write. This setting is useful if writes to the cache are much more expensive than reads from the cache, for example, if the cache is a distributed cache.It's not usually necessary to set this explicitly because, by default, it's set to a sensible value by the second-level cache implementation.
- See Also:
- Default Value:
- The cache provider's default
-
USE_STRUCTURED_CACHE
Enables the use of structured second-level cache entries. This makes the cache entries human-readable, but carries a performance cost.- See Also:
- Default Value:
false
-
AUTO_EVICT_COLLECTION_CACHE
Enables the automatic eviction of a bidirectional association's collection cache when an element in theManyToOnecollection is added, updated, or removed without properly managing the change on theOneToManyside.- See Also:
- Default Value:
false
-
USE_DIRECT_REFERENCE_CACHE_ENTRIES
Enable direct storage of entity references into the second level cache when applicable. This is appropriate only for immutable entities.By default, entities are always stored in a "disassembled" form, that is, as a tuple of attribute values.
- See Also:
- Default Value:
false
-
CACHE_KEYS_FACTORY
Deprecated.this is only honored forhibernate-infinispanSpecifies theCacheKeysFactoryto use, either:- an instance of
CacheKeysFactory, - a
ClassimplementingCacheKeysFactory, - the name of a class implementing
CacheKeysFactory, "default"as a short name forDefaultCacheKeysFactory, or"simple"as a short name forSimpleCacheKeysFactory.
- Since:
- 5.2
- See Also:
- an instance of
-
CLASS_CACHE_PREFIX
Entity cache configuration properties follow the patternhibernate.classcache.packagename.ClassName usage[, region]whereusageis the cache strategy used andregionthe cache region name- See Also:
-
COLLECTION_CACHE_PREFIX
Collection cache configuration properties follow the patternhibernate.collectioncache.packagename.ClassName.role usage[, region]whereusageis the cache strategy used andregionthe cache region name- See Also:
-
JPA_SHARED_CACHE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_MODEinstead- See Also:
-
JPA_SHARED_CACHE_RETRIEVE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_RETRIEVE_MODEinstead- See Also:
-
JPA_SHARED_CACHE_STORE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_STORE_MODEinstead- See Also:
-
hibernate-infinispan