ca.uhn.cache.internal.impl
Class DefaultUnusedChunkRule

java.lang.Object
  extended byca.uhn.cache.internal.impl.DefaultUnusedChunkRule
All Implemented Interfaces:
IUnusedChunkRule

public class DefaultUnusedChunkRule
extends java.lang.Object
implements IUnusedChunkRule

Default implementation of IUnusedChunkRule.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:54:03 $ by $Author: bryan_tripp $
Author:
Bryan Tripp

Constructor Summary
DefaultUnusedChunkRule(java.util.Map theModifiers)
           
 
Method Summary
 long getVoguenessModifier(IChunk theChunk)
          For use with the least-recently-used (LRU) mode of cache eviction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUnusedChunkRule

public DefaultUnusedChunkRule(java.util.Map theModifiers)
Parameters:
theModifiers - keys are CacheReasonEnum, values are corresponding Longs representing vogueness modifiers for each reason (default is 0)
Method Detail

getVoguenessModifier

public long getVoguenessModifier(IChunk theChunk)
Description copied from interface: IUnusedChunkRule
For use with the least-recently-used (LRU) mode of cache eviction. By default, if the cache gets too full, the least recently used chunks are evicted until the cache is small enough (LRU means chunks with last access times the farthest in the past). Sometimes this isn't optimal. For example, a chunk may be cached because it will definitly be used in the next 30 minutes, but may be evicted after 20 minutes while other single-use chunks remain cached. This method defines a modifier on last access time, to account for special circumstances. This allows us to change the LRU rule from "evict if last_access_time less than x" to "evict if (last_access_time + modifier) less than x", which is more flexible. The resulting index (i.e. last_access_time + modifier) we call vogueness.

Specified by:
getVoguenessModifier in interface IUnusedChunkRule
Parameters:
theChunk - a chunk to be cached
Returns:
the time (ms) by which to shift the last access time when evaluating for eviction
See Also:
IUnusedChunkRule.getVoguenessModifier(ca.uhn.cache.internal.IChunk)


Copyright © 2004-2005 University Health Network. All Rights Reserved.