Thanks again for the quick replies and clarifications. I now understand that the file will not grow indefinitely as you have the "OptimizeAtRemoveCount" option - that makes me feel better - except that if you don't get a lot of removes for a while, the file could get quite large. Have you thought about adding something like "OptimizeAtRecycleSize"? I'm thinking about extending the existing classes to do something like this - if the number of items in the recycle are X then optimize. Any thoughts?
Thanks again, Josh Fuller On 9/20/05, Smuts, Aaron <[EMAIL PROTECTED]> wrote: > > Max objects at the region level sets configures the memory manager. > > http://jakarta.apache.org/jcs/RegionProperties.html > > If you use the indexed disk cache, then the MaxKeySize setting on that > auxiliary, configures the number of disk indexes that the disk can have. > > http://jakarta.apache.org/jcs/IndexedDiskCacheProperties.html > > This configuration limits the memory cache to 10 and the disk cache to > 1000 keys: > > ############################################################## > > ##### Default Region Configuration > > 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 > > ############################################################## > > ##### AUXILIARY CACHES > > # Indexed Disk Cache > > 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=target/test-sandbox/indexed-disk-cache > > jcs.auxiliary.DC.attributes.MaxPurgatorySize=500 > > jcs.auxiliary.DC.attributes.MaxKeySize=1000 > > jcs.auxiliary.DC.attributes.MaxRecycleBinSize=300 > > ------------------------------ > > *From:* Joshua Fuller [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, September 20, 2005 3:16 PM > *To:* Smuts, Aaron > *Cc:* JCS Users List > *Subject:* Re: Limiting Disk Cache Size? > > I'm sorry I seem so confused on this - but I think it must come from a > misunderstanding of how the disk cache is used in the first place. The site > says "When the memory cache exceeds its maximum size it tells the cache hub > that the item to be removed from memory should be spooled to disk." What is > the "maximum size" then that is being referred to? I was under the > impression it was the "jcs.default.cacheattributes.MaxObjects" value, but > that does not seem to make sense now either. Can you clarify what values do > what in regards to disk cache? If I want 10 items in memory, and 1000 items > on disk in my cache - how can I do that? > > Thanks, > Josh Fuller > > On 9/20/05, *Smuts, Aaron* <[EMAIL PROTECTED]> wrote: > > ------------------------------ > > *From:* Joshua Fuller [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, September 20, 2005 12:40 PM > *To:* Smuts, Aaron > *Cc:* JCS Users List > *Subject:* Re: Limiting Disk Cache Size? > > Thanks for your quick response and help. So would you recommend setting > up multiple disk cache, and using the MaxKeySize value to limit it? Or is > your last statement saying that the MaxKeySize will not actually limit the > size of objects on the disk anyway, but only the number of keys in memory? > > The indexec disk cache is a memory index of items on disk. The keys and > the starting location of on disk for an item are stored in memory. The > maxkeysize on the disk cache limits the number of keys stored in the index. > This has nothing to do with the max size setting on the memory cache. > > So to clarify, if I have a database of 100,000 records that are heavily > used - and I have a cache setup with a MaxKeySize of 1,000 - then there is > nothing preventing all 100,000 records from being spooled to disk as long as > they have yet to expire? > > Yes and no. All of them can get spooled, but only 1000 will be available. > > > > > A follow-up question to that would be - Does the memory shrinker thread > get used also to clean up the disk cache items that may have expired, or how > do they get cleaned out? > > Nope. It is just a memory cache shrinker. > > They get cleaned out when remove is called. Remove is called when you > call remove or when you call get and an item is found to be expired. > > > Thanks, > Josh Fuller > > On 9/20/05, *Smuts, Aaron* <[EMAIL PROTECTED]> wrote: > > You can only limit the number of keys, not the size of the file. The > disk cache keeps track of empty spots from where an item has been > removed and it tries to reuse them, but this doesn't stop it from > growing indefinitely if you keep putting larger and larger items on > disk. I don't think that the disk cache marks a spot as available when > a key is spooled off the disk cache key lru. . . . > > > -----Original Message----- > > From: Joshua Fuller [mailto: [EMAIL PROTECTED] > > Sent: Monday, September 19, 2005 9:07 PM > > To: jcs-users@jakarta.apache.org > > Subject: Fwd: Limiting Disk Cache Size? > > > > Sorry, if this is a repeat - the last email didnt seem to send so I'm > > trying > > again...... > > > > Is there a way to limit the size of the items in the cache being > stored to > > disk for a given region, or even globally? I can't find any setting > > anywhere > > that limits the size of the files on disk (by number of elements or > > physical). > > > > Thanks, > > Josh Fuller > >