1

I recently set up my first JCS cache which persists my Serializable objects to local disk (so that I can restart my application and continue using the cache, etc.).

I used JCS directly but I'd like to use javax.cache (jcache) instead but I'm having trouble finding documentation/examples of doing so.

What is the equivalent to JCS.<String, Serializable>getInstance("default") in jcache?

cache.ccf

##############################################################
##### Default Region Configuration
jcs.default=DC
jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=3
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.DiskUsagePatternName=UPDATE
jcs.default.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsSpool=true

##############################################################
##### AUXILIARY CACHES
# Indexed Disk Cache
jcs.auxiliary.DC=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=C:/LeadCloudTestDataCache
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
jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500

I tried using CacheManager.createCache but it does not seem to load cache.ccf. Do I have to convert my ccf to a javax.cache.configuration.MutableConfiguration?

mfulton26
  • 29,956
  • 6
  • 64
  • 88

0 Answers0