jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Maclean <stu...@apl.washington.edu>
Subject memory cache not written out to disk on shutdown?
Date Wed, 19 Aug 2009 19:04:24 GMT
Hi all, I am trying to use JCS in a mapping application.  I have a  
Swing map tool, which retrieves and displays map tile images from eg  
openstreetmap.org.  Logically my cache objects are Images, though I am  
converting to and from int[] for serialization.  My cache keys are a  
string encoding of the map tile components z,y,x, e.g z-y-x.

In my cache.ccf, I am specifying properties just for default regions.   
I am right in assuming that my named regions in my code 'inherit'  
their configuration from the defaults?  Is it true also that if I use  
two regions, R1 and R2, that EACH region gets its own 10 objects  
(MaxObjects) or is 10 the total number of in-memory cached objects?

What I want to happen is this.  When cache empty, go to map tile  
server and get tiles.  Store to JCS cache. Mainatin say 50 in memory  
for each tile 'layer' (where a layer maps to a tile set from one map  
server).  When my app requires the 51st image, flush LRU to disk  
cache. When my app exits, serialize the entire memory cache to disk,  
effectively using the cache as a persistence engine.  When restart my  
app, get Images from local disk before going to remote map server.

Alas, when I call shutdown (from a VM shutdown listener,is this the  
problem???) my .key and .data files on disk never seem to be updated.   
It's as though the in memory cache is never 'flushed' to disk?  Should  
it be?

I seem to be missing something here?  Any help appreciated.

Stuart

My cache.ccf is here...

jcs.default=DC
jcs 
.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=10
jcs 
.default 
.cacheattributes 
.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.MaxLifeSeconds=1000000
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true

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=${user.home}/.sgDesktop/map/cache3
jcs.auxiliary.DC.attributes.MaxKeySize=100000
jcs.auxiliary.DC.attributes.MaxPurgatorySize=100000
#jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
  
        

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message