Package org.hibernate.cache.spi
Interface RegionFactory
-
- All Superinterfaces:
Serializable,Service,Stoppable
- All Known Subinterfaces:
RegionFactory
- All Known Implementing Classes:
AbstractRegionFactory,CachingRegionFactory,JCacheRegionFactory,NoCachingRegionFactory,RegionFactoryTemplate
public interface RegionFactory extends Service, Stoppable
Contract for building second-level cache regions, including regions dedicated to storing:- entity and collection instances,
- query result sets, and
- timestamps used to determine when a cached query result set is stale.
Implementors should define a constructor in one of two forms:
MyRegionFactoryImpl(java.util.Properties)MyRegionFactoryImpl()
Use the first when we need to read config properties prior to
start(org.hibernate.boot.spi.SessionFactoryOptions, java.util.Map<java.lang.String, java.lang.Object>)being called.A
RegionFactorymay be selected using the property "hibernate.cache.region.factory_class".
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAMEstatic StringDEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description DomainDataRegionbuildDomainDataRegion(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext)Create a namedRegionfor holding domain model dataQueryResultsRegionbuildQueryResultsRegion(String regionName, SessionFactoryImplementor sessionFactory)Create a namedRegionfor holding query result sets.TimestampsRegionbuildTimestampsRegion(String regionName, SessionFactoryImplementor sessionFactory)Create a namedRegionfor holding timestamps used to determine when a cached query result set is stale.default CacheTransactionSynchronizationcreateTransactionContext(SharedSessionContractImplementor session)AccessTypegetDefaultAccessType()Get the default access type for any "user model" data.default longgetTimeout()booleanisMinimalPutsEnabledByDefault()By default, should we perform "minimal puts" when using this second level cache implementation?longnextTimestamp()Generate a timestamp.Stringqualify(String regionName)voidstart(SessionFactoryOptions settings, Map<String,Object> configValues)Lifecycle callback to perform any necessary initialization of the underlying cache provider.
-
-
-
Field Detail
-
DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME
static final String DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME
- See Also:
- Constant Field Values
-
DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME
static final String DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
void start(SessionFactoryOptions settings, Map<String,Object> configValues) throws CacheException
Lifecycle callback to perform any necessary initialization of the underlying cache provider. Called exactly once during the construction of aSessionFactoryImpl.- Parameters:
settings- The settings in effect.configValues- The available config values- Throws:
CacheException- Indicates problems starting the L2 cache impl; considered as a sign to stopSessionFactorybuilding.
-
isMinimalPutsEnabledByDefault
boolean isMinimalPutsEnabledByDefault()
By default, should we perform "minimal puts" when using this second level cache implementation?- Returns:
- True if "minimal puts" should be performed by default; false otherwise.
-
getDefaultAccessType
AccessType getDefaultAccessType()
Get the default access type for any "user model" data.
-
createTransactionContext
default CacheTransactionSynchronization createTransactionContext(SharedSessionContractImplementor session)
-
nextTimestamp
long nextTimestamp()
Generate a timestamp. This value is generally used for purpose of locking/unlocking cache content depending upon the access strategy being used. It's also expected that this be the value used by theCacheTransactionSynchronizationcreated by thisRegionFactory.- API Note:
- This "timestamp" need not be related to timestamp in the
Date.getTime()/System.currentTimeMillis()sense. It just needs to be an incrementing value.
-
getTimeout
default long getTimeout()
-
buildDomainDataRegion
DomainDataRegion buildDomainDataRegion(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext)
Create a namedRegionfor holding domain model data- Parameters:
regionConfig- The user requested caching configuration for this RegionbuildingContext- Access to delegates useful in building the Region
-
buildQueryResultsRegion
QueryResultsRegion buildQueryResultsRegion(String regionName, SessionFactoryImplementor sessionFactory)
Create a namedRegionfor holding query result sets.
-
buildTimestampsRegion
TimestampsRegion buildTimestampsRegion(String regionName, SessionFactoryImplementor sessionFactory)
Create a namedRegionfor holding timestamps used to determine when a cached query result set is stale.
-
-