avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Morris" <David.Mor...@plumcreek.com>
Subject Re: Cache question
Date Mon, 12 Nov 2001 19:24:31 GMT

We used the cache I described to store a repository of application 
components. There was a lot of inherited reuse; for example a field 
definition would be part of a file as well as an entry panel. All parts of 
the applications interpreted at run time.

All items in the cache had a use counter. A cache also had a maximum 
and minimum size. For example 120 minimum and 200 max. It also had 
a miss counter that was incremented on each cache miss. A likely 
value might be 2,000. This could also be a rolling percentage of misses. 
When this threshold is hit, a reorganization occurs.

Basically, when an object is requested from the cache, it is added if it 
is not there and the cache has not reached its maximum size. Each 
retrieval increments the use counter for an item in the cache. Every so 
often the cache is reorganized so that the most frequently used items 
move to the top and least used items are tagged as expired.

When an item is requested from the cache, the item is added if it doesn't 
exist and the maximum size has not been reached. The use count is also 
incremented and the expired tag is set/reset. 

I also found it useful to keep the key and a direct reference to the last 
item requested. Our application structure is pretty modular and this 
simplified coding.

David Morris

>>> donaldp@apache.org 11/10/01 12:53AM >>>

On Thu, 8 Nov 2001 07:16, David Morris wrote:
> I am new to this group and just stumbled upon the cache implementation
> while looking for  a project that used docbook. Hopefully I am not asking
> something that has already been covered. From the archives, I see that the
> cache as found in the sandbox is pretty much complete but needs testing. I
> have also seen the cache implementation used in Cocoon2. A while back I
> wrote a cache that supports hierarchical data stored on an iSeries system.
> That cache was written in RPGIV, but I think the basic concepts are the
> same.


> Do you think that a frequent use cache would be useful? 


In an implementation I created a few years ago I rated each cache entry 
accorind to the following simple algo.

rating = cost * value

value was essentially the frequency of hits in some window of time
cost was the cost of recreating the cache entry. Sometimes entries cost more 
to create and if at all possible you want to keep them in memory rather than 
recreate them. Then the lowest value hit was always removed from cache.

> In our applications
> it worked better than either a LRU or FIFO cache. To do this I think a hit
> counter in the memory cache store and a cache implementation that
> reorganized after n number of hits might work well. 

I am not sure what you mean "reorganize" - could you expand.

> In the cache I built I
> also supported a prior key/entry directly with no lookup.

you mean that it was a permanent resident of cache or something ?



For every complex problem there is a solution that 
is simple, neat and wrong

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message