Class JDBCDiskCacheFactory
java.lang.Object
org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheFactory
org.apache.commons.jcs3.auxiliary.disk.jdbc.JDBCDiskCacheFactory
- All Implemented Interfaces:
AuxiliaryCacheFactory,IRequireScheduler
- Direct Known Subclasses:
HSQLDiskCacheFactory,MySQLDiskCacheFactory
public class JDBCDiskCacheFactory
extends AbstractAuxiliaryCacheFactory
implements IRequireScheduler
This factory should create JDBC auxiliary caches.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String.attributesprotected static final Stringprops prefixprotected ScheduledExecutorServiceThe background scheduler, one for all regions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<K,V> JDBCDiskCache<K, V> createCache(AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer) This factory method should create an instance of the jdbc cache.protected voidcreateShrinkerWhenNeeded(JDBCDiskCacheAttributes cattr, JDBCDiskCache<?, ?> raf) If UseDiskShrinker is true then we will create a shrinker daemon if necessary.voiddispose()Dispose of this factory, clean up shared resourcesprotected DataSourceFactorygetDataSourceFactory(JDBCDiskCacheAttributes cattr, Properties configProps) manages the DataSourceFactories.protected ScheduledExecutorServiceGet the scheduler serviceprotected TableStategetTableState(String tableName) Get a table state for a given table namevoidInitialize this factoryvoidsetScheduledExecutorService(ScheduledExecutorService scheduledExecutor) Inject an instance of a central ScheduledExecutorServiceMethods inherited from class org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheFactory
getName, setName
-
Field Details
-
scheduler
The background scheduler, one for all regions. Injected by the configurator -
POOL_CONFIGURATION_PREFIX
props prefix- See Also:
-
ATTRIBUTE_PREFIX
.attributes- See Also:
-
-
Constructor Details
-
JDBCDiskCacheFactory
public JDBCDiskCacheFactory()
-
-
Method Details
-
createCache
public <K,V> JDBCDiskCache<K,V> createCache(AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer) throws SQLException This factory method should create an instance of the jdbc cache.- Specified by:
createCachein interfaceAuxiliaryCacheFactory- Parameters:
rawAttr- specific cache configuration attributescompositeCacheManager- the global cache managercacheEventLogger- a specific logger for cache eventselementSerializer- a serializer for cache elements- Returns:
- JDBCDiskCache the cache instance
- Throws:
SQLException- if the cache instance could not be created
-
initialize
Initialize this factory- Specified by:
initializein interfaceAuxiliaryCacheFactory
-
dispose
Dispose of this factory, clean up shared resources- Specified by:
disposein interfaceAuxiliaryCacheFactory
-
getTableState
Get a table state for a given table name- Parameters:
tableName-- Returns:
- a cached instance of the table state
-
setScheduledExecutorService
Description copied from interface:IRequireSchedulerInject an instance of a central ScheduledExecutorService- Specified by:
setScheduledExecutorServicein interfaceIRequireScheduler- See Also:
-
getScheduledExecutorService
Get the scheduler service- Returns:
- the scheduler
-
createShrinkerWhenNeeded
If UseDiskShrinker is true then we will create a shrinker daemon if necessary.- Parameters:
cattr-raf-
-
getDataSourceFactory
protected DataSourceFactory getDataSourceFactory(JDBCDiskCacheAttributes cattr, Properties configProps) throws SQLException manages the DataSourceFactories.- Parameters:
cattr- the cache configurationconfigProps- the configuration properties object- Returns:
- a DataSourceFactory
- Throws:
SQLException- if a database access error occurs
-