Interface CacheSettings
-
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface CacheSettings
Settings for Hibernate's second-level caching
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTO_EVICT_COLLECTION_CACHE
static String
CACHE_KEYS_FACTORY
Deprecated.this is only honored forhibernate-infinispan
static String
CACHE_REGION_FACTORY
TheRegionFactory
implementation, either: an instance ofRegionFactory
, aClass
implementingRegionFactory
, or the name of a class implementingRegionFactory
.static String
CACHE_REGION_PREFIX
TheCacheProvider
region name prefixstatic String
CLASS_CACHE_PREFIX
Entity cache configuration properties follow the patternhibernate.classcache.packagename.ClassName usage[, region]
whereusage
is the cache strategy used andregion
the cache region namestatic String
COLLECTION_CACHE_PREFIX
Collection cache configuration properties follow the patternhibernate.collectioncache.packagename.ClassName.role usage[, region]
whereusage
is the cache strategy used andregion
the cache region namestatic String
DEFAULT_CACHE_CONCURRENCY_STRATEGY
Specifies theCacheConcurrencyStrategy
to use by default when an entity is marked@Cacheable
, but no concurrency strategy is explicitly specified via theCache
annotation.static String
JAKARTA_SHARED_CACHE_MODE
When enabled, specifies that the second-level cache (which JPA calls the "shared" cache) may be used, as per the rules defined in JPA 2 section 3.1.7.static String
JAKARTA_SHARED_CACHE_RETRIEVE_MODE
Set a default value forSpecHints.HINT_SPEC_CACHE_RETRIEVE_MODE
, used when the hint is not explicitly specified.static String
JAKARTA_SHARED_CACHE_STORE_MODE
Set a default value forSpecHints.HINT_SPEC_CACHE_STORE_MODE
, used when the hint is not explicitly specified.static String
JPA_SHARED_CACHE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_MODE
insteadstatic String
JPA_SHARED_CACHE_RETRIEVE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_RETRIEVE_MODE
insteadstatic String
JPA_SHARED_CACHE_STORE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_STORE_MODE
insteadstatic String
QUERY_CACHE_FACTORY
Specifies theTimestampsCacheFactory
to use.static String
QUERY_CACHE_LAYOUT
Specifies the defaultCacheLayout
to use for the query cache.static String
USE_DIRECT_REFERENCE_CACHE_ENTRIES
Enable direct storage of entity references into the second level cache when applicable.static String
USE_MINIMAL_PUTS
Optimize interaction with the second-level cache to minimize writes, at the cost of an additional read before each write.static String
USE_QUERY_CACHE
Enable the query results cachestatic String
USE_SECOND_LEVEL_CACHE
When enabled, specifies that the second-level cache may be used.static String
USE_STRUCTURED_CACHE
Enables the use of structured second-level cache entries.
-
-
-
Field Detail
-
JAKARTA_SHARED_CACHE_MODE
static final String JAKARTA_SHARED_CACHE_MODE
When enabled, specifies that the second-level cache (which JPA calls the "shared" cache) may be used, as per the rules defined in JPA 2 section 3.1.7.See JPA 2 sections 9.4.3 and 8.2.1.7
- See Also:
SharedCacheMode
, Constant Field Values
-
JAKARTA_SHARED_CACHE_RETRIEVE_MODE
static final String 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
.
-
JAKARTA_SHARED_CACHE_STORE_MODE
static final String 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
.
-
USE_SECOND_LEVEL_CACHE
static final String USE_SECOND_LEVEL_CACHE
When enabled, specifies that the second-level cache may be used.By default, if the configured
RegionFactory
is not theNoCachingRegionFactory
, then the second-level cache is enabled. Otherwise, the second-level cache is disabled.- See Also:
CACHE_REGION_FACTORY
,SessionFactoryBuilder.applySecondLevelCacheSupport(boolean)
, Constant Field Values- Default Value:
true
when a provider is specified;false
otherwise.
-
USE_QUERY_CACHE
static final String USE_QUERY_CACHE
Enable the query results cache- See Also:
SessionFactoryBuilder.applyQueryCacheSupport(boolean)
, Constant Field Values- Default Value:
false
-
QUERY_CACHE_LAYOUT
@Incubating static final String QUERY_CACHE_LAYOUT
Specifies the defaultCacheLayout
to use for the query cache.- Since:
- 6.5
- See Also:
SessionFactoryBuilder.applyQueryCacheLayout(CacheLayout)
,QueryCacheLayout
, Constant Field Values
-
CACHE_REGION_FACTORY
static final String CACHE_REGION_FACTORY
TheRegionFactory
implementation, either:- an instance of
RegionFactory
, - a
Class
implementingRegionFactory
, or - the name of a class implementing
RegionFactory
.
Defaults to
NoCachingRegionFactory
, so that caching is disabled.- See Also:
USE_SECOND_LEVEL_CACHE
, Constant Field Values
- an instance of
-
QUERY_CACHE_FACTORY
static final String QUERY_CACHE_FACTORY
Specifies theTimestampsCacheFactory
to use.
-
CACHE_REGION_PREFIX
static final String CACHE_REGION_PREFIX
TheCacheProvider
region name prefix
-
DEFAULT_CACHE_CONCURRENCY_STRATEGY
static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY
Specifies theCacheConcurrencyStrategy
to use by default when an entity is marked@Cacheable
, but no concurrency strategy is explicitly specified via theCache
annotation.An explicit strategy may be specified using
@Cache(usage=...)
.- See Also:
MetadataBuilder.applyAccessType(org.hibernate.cache.spi.access.AccessType)
,RegionFactory.getDefaultAccessType()
, Constant Field Values- Default Value:
- The cache provider's default strategy
-
USE_MINIMAL_PUTS
static final String 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:
SessionFactoryBuilder.applyMinimalPutsForCaching(boolean)
,RegionFactory.isMinimalPutsEnabledByDefault()
, Constant Field Values- Default Value:
- The cache provider's default
-
USE_STRUCTURED_CACHE
static final String 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:
SessionFactoryBuilder.applyStructuredCacheEntries(boolean)
, Constant Field Values- Default Value:
false
-
AUTO_EVICT_COLLECTION_CACHE
static final String AUTO_EVICT_COLLECTION_CACHE
Enables the automatic eviction of a bidirectional association's collection cache when an element in theManyToOne
collection is added, updated, or removed without properly managing the change on theOneToMany
side.- See Also:
SessionFactoryBuilder.applyAutomaticEvictionOfCollectionCaches(boolean)
, Constant Field Values- Default Value:
false
-
USE_DIRECT_REFERENCE_CACHE_ENTRIES
static final String 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:
SessionFactoryBuilder.applyDirectReferenceCaching(boolean)
, Constant Field Values- Default Value:
false
-
CACHE_KEYS_FACTORY
@Deprecated static final String CACHE_KEYS_FACTORY
Deprecated.this is only honored forhibernate-infinispan
Specifies theCacheKeysFactory
to use, either:- an instance of
CacheKeysFactory
, - a
Class
implementingCacheKeysFactory
, - 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:
- Constant Field Values
- an instance of
-
CLASS_CACHE_PREFIX
static final String CLASS_CACHE_PREFIX
Entity cache configuration properties follow the patternhibernate.classcache.packagename.ClassName usage[, region]
whereusage
is the cache strategy used andregion
the cache region name- See Also:
- Constant Field Values
-
COLLECTION_CACHE_PREFIX
static final String COLLECTION_CACHE_PREFIX
Collection cache configuration properties follow the patternhibernate.collectioncache.packagename.ClassName.role usage[, region]
whereusage
is the cache strategy used andregion
the cache region name- See Also:
- Constant Field Values
-
JPA_SHARED_CACHE_MODE
@Deprecated static final String JPA_SHARED_CACHE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_MODE
insteadUsed to indicate whether second-level (what JPA terms shared cache) caching is enabled as per the rules defined in JPA 2 section 3.1.7.See JPA 2 sections 9.4.3 and 8.2.1.7
- See Also:
SharedCacheMode
, Constant Field Values
-
JPA_SHARED_CACHE_RETRIEVE_MODE
@Deprecated static final String JPA_SHARED_CACHE_RETRIEVE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_RETRIEVE_MODE
instead- See Also:
- Constant Field Values
-
JPA_SHARED_CACHE_STORE_MODE
@Deprecated static final String JPA_SHARED_CACHE_STORE_MODE
Deprecated.UseJAKARTA_SHARED_CACHE_STORE_MODE
instead- See Also:
- Constant Field Values
-
-