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 String
props prefixprotected ScheduledExecutorService
The 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 void
createShrinkerWhenNeeded
(JDBCDiskCacheAttributes cattr, JDBCDiskCache<?, ?> raf) If UseDiskShrinker is true then we will create a shrinker daemon if necessary.void
dispose()
Dispose of this factory, clean up shared resourcesprotected DataSourceFactory
getDataSourceFactory
(JDBCDiskCacheAttributes cattr, Properties configProps) manages the DataSourceFactories.protected ScheduledExecutorService
Get the scheduler serviceprotected TableState
getTableState
(String tableName) Get a table state for a given table namevoid
Initialize this factoryvoid
setScheduledExecutorService
(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:
createCache
in 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:
initialize
in interfaceAuxiliaryCacheFactory
-
dispose
Dispose of this factory, clean up shared resources- Specified by:
dispose
in 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:IRequireScheduler
Inject an instance of a central ScheduledExecutorService- Specified by:
setScheduledExecutorService
in 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
-