Apache Commons logo

Commons JCS™

Indexed Disk Auxiliary Cache Configuration

The following properties apply to the Indexed Disk Cache plugin.

Indexed Disk Configuration Properties

Property Description Required Default Value
DiskPath The directory where the disk cache should write its files. Y n/a
MaxPurgatorySize The maximum number of items allowed in the queue of items to be written to disk. N 5000
MaxKeySize The maximum number of keys that the indexed disk cache can have. Since the keys are stored in memory, you may want to limit this number to something reasonable. The default is a bit small. N 5000
OptimizeAtRemoveCount At how many removes should the cache try to defragment the data file. Since we recycle empty spots, defragmentation is usually not needed. To prevent the cache from defragmenting the data file, you can set this to -1. This is the default value. N -1
OptimizeOnShutdown By default the Indexed Disk Cache will optimize on shutdown if the free data size is greater than 0. If you want to prevent this behavior, you can set this parameter to false. N true
ClearDiskOnStartup By default the Indexed Disk Cache will use items found on disk on startup. If you set this value to true, the old key and data files will be cleared. N false

Example Configuration

					
jcs.auxiliary.DC=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC.attributes.MaxKeySize=10000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC.attributes.ClearDiskOnStartup=false
        
				

Indexed 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

					
jcs.auxiliary.DC=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
jcs.auxiliary.DC.attributes.MaxKeySize=10000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC.attributes.EventQueueType=POOLED
jcs.auxiliary.DC.attributes.EventQueuePoolName=disk_cache_event_queue

# Disk Cache pool
thread_pool.disk_cache_event_queue.boundarySize=50
thread_pool.disk_cache_event_queue.useBoundary=true
thread_pool.disk_cache_event_queue.maximumPoolSize=15
thread_pool.disk_cache_event_queue.minimumPoolSize=1
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.startUpSize=1
thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN