JDBC Disk Auxiliary Cache Configuration
The following properties apply to the JDBC Disk Cache
plugin.
JDBC Disk Configuration Properties
Property |
Description |
Required |
Default Value |
MaxPurgatorySize |
The maximum number of items allowed in the
queue of items to be written to disk.
|
N |
5000 |
url |
The database url. The database name will be
added to this value to create the full
database url.
|
N |
|
database |
This is appended to the url. |
N |
|
driverClassName |
The class name of the driver to talk to your
database.
|
N |
|
userName |
The database user name. |
N |
|
password |
The database user password. |
N |
|
jndiPath |
The JNDI lookup path in the form java:comp/env/jdbc/MyDB .
This entry is preferred over the set of url , driverClassName ,
userName and password .
|
N |
|
jndiTTL |
The time between two JNDI lookups in ms. |
N |
0 |
tableName |
The name of the table. |
N |
JCS_STORE |
testBeforeInsert |
Should the disk cache do a select before
trying to insert new element on update, or
should it try to insert and handle the
error.
|
N |
true |
maxActive |
This sets the maximum number of connections
allowed.
|
Y |
|
allowRemoveAll |
Should the disk cache honor remove all (i.e.
clear) requests. You might set this to false
to prevent someone from accidentally
clearing out an entire database.
|
N |
true |
UseDiskShrinker |
Should the disk cache try to delete expired
items from the database.
|
N |
true |
ShrinkerInterval |
How often should the disk shrinker run (in seconds). |
N |
300 |
Example Configuration
##############################################################
################## AUXILIARY CACHES AVAILABLE ################
# JDBC disk cache
jcs.auxiliary.JDBC=org.apache.commons.jcs3.auxiliary.disk.jdbc.JDBCDiskCacheFactory
jcs.auxiliary.JDBC.attributes=org.apache.commons.jcs3.auxiliary.disk.jdbc.JDBCDiskCacheAttributes
jcs.auxiliary.JDBC.attributes.userName=sa
jcs.auxiliary.JDBC.attributes.password=
jcs.auxiliary.JDBC.attributes.url=jdbc:hsqldb:
jcs.auxiliary.JDBC.attributes.database=target/cache_hsql_db
jcs.auxiliary.JDBC.attributes.driverClassName=org.hsqldb.jdbcDriver
jcs.auxiliary.JDBC.attributes.tableName=JCS_STORE2
jcs.auxiliary.JDBC.attributes.testBeforeInsert=false
jcs.auxiliary.JDBC.attributes.maxActive=15
jcs.auxiliary.JDBC.attributes.allowRemoveAll=true
jcs.auxiliary.JDBC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.JDBC.attributes.UseDiskShrinker=true
jcs.auxiliary.JDBC.attributes.ShrinkerInterval=300
JDBC Disk Event Queue Configuration
Property |
Description |
Required |
Default Value |
EventQueueType |
This should be either SINGLE or POOLED. By
default the single style pool is used. The
single style pool uses a single thread per
event queue. That thread is killed whenever
the queue is inactive for 30 seconds. Since
the disk cache uses an event queue for every
region, if you have many regions and they
are all active, you will be using many
threads. To limit the number of threads, you
can configure the disk cache to use the
pooled event queue. Using more threads than
regions will not add any benefit for the
indexed disk cache, since only one thread
can read or write at a time for a single
region.
|
N |
SINGLE |
EventQueuePoolName |
This is the name of the pool to use. It is
required if you choose the POOLED event
queue type, otherwise it is ignored.
|
Y |
n/a |
Example Configuration Using Thread Pool
##############################################################
################## AUXILIARY CACHES AVAILABLE ################
# JDBC disk cache
jcs.auxiliary.JDBC=org.apache.commons.jcs3.auxiliary.disk.jdbc.JDBCDiskCacheFactory
jcs.auxiliary.JDBC.attributes=org.apache.commons.jcs3.auxiliary.disk.jdbc.JDBCDiskCacheAttributes
jcs.auxiliary.JDBC.attributes.userName=sa
jcs.auxiliary.JDBC.attributes.password=
jcs.auxiliary.JDBC.attributes.url=jdbc:hsqldb:
jcs.auxiliary.JDBC.attributes.database=target/cache_hsql_db
jcs.auxiliary.JDBC.attributes.driverClassName=org.hsqldb.jdbcDriver
jcs.auxiliary.JDBC.attributes.tableName=JCS_STORE2
jcs.auxiliary.JDBC.attributes.testBeforeInsert=false
jcs.auxiliary.JDBC.attributes.maxActive=15
jcs.auxiliary.JDBC.attributes.allowRemoveAll=true
jcs.auxiliary.JDBC.attributes.MaxPurgatorySize=10000000
jcs.auxiliary.JDBC.attributes.UseDiskShrinker=true
jcs.auxiliary.JDBC.attributes.ShrinkerInterval=300
jcs.auxiliary.JDBC.attributes.EventQueueType=POOLED
jcs.auxiliary.JDBC.attributes.EventQueuePoolName=disk_cache_event_queueue
##############################################################
################## OPTIONAL THREAD POOL CONFIGURATION #########
# Disk Cache pool
thread_pool.disk_cache_event_queue.useBoundary=false
thread_pool.disk_cache_event_queue.boundarySize=500
thread_pool.disk_cache_event_queue.maximumPoolSize=15
thread_pool.disk_cache_event_queue.minimumPoolSize=10
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
thread_pool.disk_cache_event_queue.startUpSize=10
|