ehcache

net.sf.ehcache.store
Class LruPolicy

java.lang.Object
  extended by net.sf.ehcache.store.AbstractPolicy
      extended by net.sf.ehcache.store.LruPolicy
All Implemented Interfaces:
Policy

public class LruPolicy
extends AbstractPolicy

Contains common LFU policy code for use between the LfuMemoryStore and the DiskStore, which also uses an LfuPolicy for evictions.

Version:
$Id: LruPolicy.java 5594 2012-05-07 16:04:31Z cdennis $
Author:
Greg Luck

Field Summary
static String NAME
          The name of this policy as a string literal
 
Constructor Summary
LruPolicy()
           
 
Method Summary
 boolean compare(Element element1, Element element2)
          Compares the desirableness for eviction of two elements Compares hit counts.
 String getName()
           
 
Methods inherited from class net.sf.ehcache.store.AbstractPolicy
calculateSampleSize, generateRandomSample, selectedBasedOnPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
The name of this policy as a string literal

See Also:
Constant Field Values
Constructor Detail

LruPolicy

public LruPolicy()
Method Detail

getName

public String getName()
Returns:
the name of the Policy. Inbuilt examples are LRU, LFU and FIFO.

compare

public boolean compare(Element element1,
                       Element element2)
Compares the desirableness for eviction of two elements Compares hit counts. If both zero,

Parameters:
element1 - the element to compare against
element2 - the element to compare
Returns:
true if the second element is preferable to the first element for ths policy

ehcache

Copyright 2001-2016, Terracotta, Inc.