jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tore Halset <hal...@pvv.ntnu.no>
Subject creating a SoftReference cache
Date Tue, 30 Sep 2008 07:17:04 GMT

I am caching some huge objects in a JCS disc cache. The objects are  
3-15MB in serialized size and there are a lot of them. The normal  
setup with a LRUMemoryCache and a IndexedDiskCache works fine, but I  
would like to store as many objects in ram as possible without risking  
going out of ram. To get to this goal I have created a  
SoftReferenceMemoryCache that is based on a  
ConcurrentHashMap<Serializable, SoftReference<ICacheElement>>.

It is working pretty well except for that I do not have control over  
how JCS decide what/when to send to the IndexedDiskCache. How is this  

My freeElements() method simply return 0 as I do not want JCS to clear  
away items in this cache. Is that okay or will it prevent JCS from  
sending things to the disc cache?

My waterfal method call cc.spoolToDisk. When will JCS use this method?  
Is it safe to call waterfal form inside the update-method or is  
waterfal supposed to be called from some other thread?

  - Tore.

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

View raw message