net.dontdrinkandroot.cache.expungestrategy.impl
Class AbstractMaxSizeExpungeStrategy

java.lang.Object
  extended by net.dontdrinkandroot.cache.expungestrategy.impl.AbstractMaxSizeExpungeStrategy
All Implemented Interfaces:
ExpungeStrategy
Direct Known Subclasses:
AbstractOneOverMaxSizeExpungeStrategy, AbstractRecyclingExpungeStrategy

public abstract class AbstractMaxSizeExpungeStrategy
extends Object
implements ExpungeStrategy

An ExpungeStrategy that selects all expired entries and entries according to the implementation so that after those entries have been expunged the cache size is not larger that the given max size.

Author:
Philip W. Sorst

Field Summary
protected  int maxSize
           
 
Constructor Summary
AbstractMaxSizeExpungeStrategy(int maxSize)
          Constructs a new AbstractMaxSizeExpungeStrategy with the given max size.
 
Method Summary
protected abstract
<K,M extends MetaData>
Comparator<Map.Entry<K,M>>
getComparator()
           
 int getMaxSize()
          Get the current max size of this strategy.
<K,M extends MetaData>
Collection<Map.Entry<K,M>>
getToExpungeMetaData(Set<Map.Entry<K,M>> entrySet)
          Returns a collection of entries that should be expunged according to this strategy.
 void setMaxSize(int maxSize)
          Set the max size of this strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.dontdrinkandroot.cache.expungestrategy.ExpungeStrategy
triggers
 

Field Detail

maxSize

protected int maxSize
Constructor Detail

AbstractMaxSizeExpungeStrategy

public AbstractMaxSizeExpungeStrategy(int maxSize)
Constructs a new AbstractMaxSizeExpungeStrategy with the given max size.

Method Detail

getMaxSize

public int getMaxSize()
Get the current max size of this strategy.


getToExpungeMetaData

public <K,M extends MetaData> Collection<Map.Entry<K,M>> getToExpungeMetaData(Set<Map.Entry<K,M>> entrySet)
Description copied from interface: ExpungeStrategy
Returns a collection of entries that should be expunged according to this strategy.

Specified by:
getToExpungeMetaData in interface ExpungeStrategy

setMaxSize

public void setMaxSize(int maxSize)
Set the max size of this strategy.


getComparator

protected abstract <K,M extends MetaData> Comparator<Map.Entry<K,M>> getComparator()


Copyright © 2013 dontdrinkandroot. All Rights Reserved.