简体   繁体   中英

How can I configure the disk cache jcs

I am implementing the disk cache (jcs) for the first time. I would like to configure the cache.ccf file to allow the disk caching. My cache.ccf file has this configuration:

jcs.region.lesson=blockDiskCache
jcs.region.lesson.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.lesson.cacheattributes.MaxObjects=2
jcs.region.lesson.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache


    jcs.auxiliary.blockDiskCache=org.apache.commons.jcs.auxiliary.disk.block.BlockDiskCacheFactory
       jcs.auxiliary.blockDiskCache.attributes=org.apache.commons.jcs.auxiliary.disk.block.BlockDis    kCacheAttributes
jcs.auxiliary.blockDiskCache.attributes.DiskPath=user.home/jcs_swap
jcs.auxiliary.blockDiskCache.attributes.MaxPurgatorySize=300000
jcs.auxiliary.blockDiskCache.attributes.MaxKeySize=1000000
jcs.auxiliary.blockDiskCache.attributes.blockSizeBytes=500
jcs.auxiliary.blockDiskCache.attributes.EventQueueType=SINGLE

thread_pool.default.boundarySize=2000
thread_pool.default.maximumPoolSize=150
thread_pool.default.minimumPoolSize=4
thread_pool.default.keepAliveTime=350000

thread_pool.default.whenBlockedPolicy=RUN
thread_pool.default.startUpSize=4

thread_pool.disk_cache_event_queue.useBoundary=false
thread_pool.disk_cache_event_queue.minimumPoolSize=2
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.startUpSize=10

I checked the debug and I saw the following: The first object is saved in the cache. When I save the second object (the memory cache exceeds its maximum size ), this object is not saved in the disk. I dont know if the problem is in jcs.auxiliary.blockDiskCache.attributes.DiskPath property or in another configuration.

Can you help me, please?

Thanks :)

Did you mean jcs.auxiliary.blockDiskCache.attributes.DiskPath= ${user.home} /jcs_swap?

You might also try setting jcs.region.lesson.cacheattributes.MaxObjects=0 and/or add jcs.region.lesson.cacheattributes.DiskUsagePatternName=UPDATE to help debug the disk cache settings. It should write to disk regardless with these.

Block Disk Auxiliary Cache

The Block Disk Cache stores cached values on disk. Like the Indexed Disk Cache, the Block Disk Cache keeps the keys in memory . The Block Disk Cache stores the values in a group of fixed size blocks , whereas the Indexed Disk Cache writes items to disk in one chunk .

The Block Disk Cache has advantages over the normal indexed model for regions where the size of the items varies. Since all the blocks are the same size , the recycle bin is very simple. It is just a list of block numbers. Also, the Block Disk Cache will never need to be optimized. Once the maximum number of keys is reached, blocks will be reused.

All of the necessary information located at : https://commons.apache.org/proper/commons-jcs/BlockDiskCache.html

For the block disk cache, KEYS are stored at Memory. values are stored at disk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM