org.hibernate.cache.spi
Interface RegionFactory

All Superinterfaces:
Serializable, Service
All Known Subinterfaces:
RegionFactory
All Known Implementing Classes:
CachingRegionFactory, EhCacheRegionFactory, InfinispanRegionFactory, JndiInfinispanRegionFactory, NoCachingRegionFactory, SingletonEhCacheRegionFactory

public interface RegionFactory
extends Service

Contract for building second level cache regions.

Implementors should define a constructor in one of two forms:

Use the first when we need to read config properties prior to start(Settings, Properties) being called.


Method Summary
 CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing collection data.
 EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing entity data.
 NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata)
          Build a cache region specialized for storing NaturalId to Primary Key mappings.
 QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
          Build a cache region specialized for storing query results
 TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
          Build a cache region specialized for storing update-timestamps data.
 AccessType getDefaultAccessType()
          Get the default access type for entity and collection regions.
 boolean isMinimalPutsEnabledByDefault()
          By default should we perform "minimal puts" when using this second level cache implementation?
 long nextTimestamp()
          Generate a timestamp.
 void start(Settings settings, Properties properties)
          Lifecycle callback to perform any necessary initialization of the underlying cache implementation(s).
 void stop()
          Lifecycle callback to perform any necessary cleanup of the underlying cache implementation(s).
 

Method Detail

start

void start(Settings settings,
           Properties properties)
           throws CacheException
Lifecycle callback to perform any necessary initialization of the underlying cache implementation(s). Called exactly once during the construction of a SessionFactoryImpl.

Parameters:
settings - The settings in effect.
properties - The defined cfg properties
Throws:
CacheException - Indicates problems starting the L2 cache impl; considered as a sign to stop SessionFactory building.

stop

void stop()
Lifecycle callback to perform any necessary cleanup of the underlying cache implementation(s). Called exactly once during SessionFactory.close().


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 entity and collection regions.

Returns:
This factory's default access type.

nextTimestamp

long nextTimestamp()
Generate a timestamp.

This is generally used for cache content locking/unlocking purposes depending upon the access-strategy being used.

Returns:
The generated timestamp.

buildEntityRegion

EntityRegion buildEntityRegion(String regionName,
                               Properties properties,
                               CacheDataDescription metadata)
                               throws CacheException
Build a cache region specialized for storing entity data.

Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildNaturalIdRegion

NaturalIdRegion buildNaturalIdRegion(String regionName,
                                     Properties properties,
                                     CacheDataDescription metadata)
                                     throws CacheException
Build a cache region specialized for storing NaturalId to Primary Key mappings.

Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildCollectionRegion

CollectionRegion buildCollectionRegion(String regionName,
                                       Properties properties,
                                       CacheDataDescription metadata)
                                       throws CacheException
Build a cache region specialized for storing collection data.

Parameters:
regionName - The name of the region.
properties - Configuration properties.
metadata - Information regarding the type of data to be cached
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildQueryResultsRegion

QueryResultsRegion buildQueryResultsRegion(String regionName,
                                           Properties properties)
                                           throws CacheException
Build a cache region specialized for storing query results

Parameters:
regionName - The name of the region.
properties - Configuration properties.
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.

buildTimestampsRegion

TimestampsRegion buildTimestampsRegion(String regionName,
                                       Properties properties)
                                       throws CacheException
Build a cache region specialized for storing update-timestamps data.

Parameters:
regionName - The name of the region.
properties - Configuration properties.
Returns:
The built region
Throws:
CacheException - Indicates problems building the region.


Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.