我是第一次实现磁盘缓存(jcs)。我想配置cache.ccf文件以允许磁盘缓存。我的cache.ccf文件具有以下配置:
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
我检查了调试,然后看到了以下内容:第一个对象保存在缓存中。当我保存第二个对象(内存缓存超过其最大大小)时,该对象未保存在磁盘中。我不知道问题是否出在jcs.auxiliary.blockDiskCache.attributes.DiskPath属性或其他配置中。
Can you help me, please?
Thanks :)
最佳答案
您是说jcs.auxiliary.blockDiskCache.attributes.DiskPath = $ {user.home} / jcs_swap吗?
您也可以尝试设置jcs.region.lesson.cacheattributes.MaxObjects = 0和/或添加jcs.region.lesson.cacheattributes.DiskUsagePatternName = UPDATE来帮助调试磁盘缓存设置。无论如何,它都应该写入磁盘。
关于java - 如何配置磁盘缓存jcs,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23908486/