net.dontdrinkandroot.cache.expungestrategy.impl
Class AbstractRecyclingExpungeStrategy

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

public abstract class AbstractRecyclingExpungeStrategy
extends AbstractMaxSizeExpungeStrategy

An AbstractMaxSizeExpungeStrategy that triggers once the cache size is larger than a max size plus a recycle size or a recycle factor.

Author:
Philip W. Sorst

Field Summary
 
Fields inherited from class net.dontdrinkandroot.cache.expungestrategy.impl.AbstractMaxSizeExpungeStrategy
maxSize
 
Constructor Summary
AbstractRecyclingExpungeStrategy(int maxSize, float recycleFactor)
          Constructs a new AbstractRecyclingExpungeStrategy with the given max size and recycle factor (a value between 0 and 1 that is the percentage of the max size to be used as the recycle size).
AbstractRecyclingExpungeStrategy(int maxSize, int recycleSize)
          Constructs a new AbstractRecyclingExpungeStrategy with the given max size and recycle size.
 
Method Summary
 int getRecycleSize()
          Get the recycle size.
 void setRecycleFactor(float recycleFactor)
          Set the recycle factor (a value between 0 and 1 that is the percentage of the max size to be used as the recycle size).
 void setRecycleSize(int recycleSize)
          Set the recycle size.
 boolean triggers(CacheStatistics statistics)
          Checks if the strategy triggers based on the given statistics.
 
Methods inherited from class net.dontdrinkandroot.cache.expungestrategy.impl.AbstractMaxSizeExpungeStrategy
getComparator, getMaxSize, getToExpungeMetaData, setMaxSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRecyclingExpungeStrategy

public AbstractRecyclingExpungeStrategy(int maxSize,
                                        float recycleFactor)
Constructs a new AbstractRecyclingExpungeStrategy with the given max size and recycle factor (a value between 0 and 1 that is the percentage of the max size to be used as the recycle size).


AbstractRecyclingExpungeStrategy

public AbstractRecyclingExpungeStrategy(int maxSize,
                                        int recycleSize)
Constructs a new AbstractRecyclingExpungeStrategy with the given max size and recycle size.

Method Detail

setRecycleSize

public void setRecycleSize(int recycleSize)
Set the recycle size.


getRecycleSize

public int getRecycleSize()
Get the recycle size.


setRecycleFactor

public void setRecycleFactor(float recycleFactor)
Set the recycle factor (a value between 0 and 1 that is the percentage of the max size to be used as the recycle size).


triggers

public boolean triggers(CacheStatistics statistics)
Description copied from interface: ExpungeStrategy
Checks if the strategy triggers based on the given statistics.



Copyright © 2013 dontdrinkandroot. All Rights Reserved.