1

This is conjunction with my previous question https://stackoverflow.com/questions/8428911/jcs-disk-cache-data-retrieval

Does JCS read from disk even after the application is shutdown.i.e I have a JCS that writes to disk.The thing is one program does the caching that is writing to disk and another one reads from the disk.I run the writing program at one time and after a few minutes the read program is run.But when the read program is run,it comes up with null data even though the write program has successfully written to disk.Do caching systems work like this.Does it just use the disk for temporary storage,even though the cache writes the objects to disk.Does the information on the disk become invalid after application shutdown or restart. I want to know whether JCS with respect to the disk part works like a storage system.

Community
  • 1
  • 1
Madusudanan
  • 1,017
  • 1
  • 15
  • 36
  • 1
    Don't phrase a question as if it's about "caching systems in general" when you're really asking about a specific implementation. The answer depends on the implementation. – Matt Ball Dec 08 '11 at 12:09

1 Answers1

1

Edit your cache.ccf file, add an option
jcs.region.YOUR_CACHE_NAME.cacheattributes.DiskUsagePatternName=UPDATE
Read this. Especially about DiskUsagePatternName.

JCS cache = JCS.getInstance("calcCache");
cache.put("keeeeeeeeeey", "vaaaaaaaalue");

This simple example works normally.

shift66
  • 11,760
  • 13
  • 50
  • 83
  • Thanks for your response,but how do I read it back.Still that null data error is only coming. – Madusudanan Dec 08 '11 at 12:34
  • I had the same issue and this helped me.Are you sure that you've added option on the right place? I can send content of my cache.ccf file if you want. – shift66 Dec 08 '11 at 12:42
  • Yes.I am quite sure.but anyway send the cache.ccf file,it will anyways be helpful.Thanks – Madusudanan Dec 08 '11 at 12:45
  • ############################################################## ##### CACHE REGIONS jcs.region.calcCache=DC jcs.region.calcCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.region.calcCache.cacheattributes.MaxObjects=1000 jcs.region.calcCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache jcs.region.calcCache.cacheattributes.DiskUsagePatternName=UPDATE ############################################################## ##### AUXILIARY CACHES # Indexed Disk Cache – shift66 Dec 08 '11 at 12:45
  • jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes jcs.auxiliary.DC.attributes.DiskPath=../scripts/calc/cache/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.MaxRecycleBinSize=7500 – shift66 Dec 08 '11 at 12:46
  • Nope.It isnt doing any good.I dont know where I am making a mistake.Can u send me a sample snippet of your code.One that is working,sorry I cant help it,because I am completely new to this. – Madusudanan Dec 08 '11 at 13:07
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/5688/discussion-between-ademiban-and-madhu-sudhan) – shift66 Dec 08 '11 at 13:17