Top Description Fields Constructors Methods
net.sf.ehcache.store

public Class LfuPolicy

extends AbstractPolicy
Class Inheritance
Imports
net.sf.ehcache.Element

Contains common LFU policy code for use between the LfuMemoryStore and the DiskStore, which also uses an LfuPolicy for evictions.
Author
Greg Luck
Version
$Id: LfuPolicy.java 5594 2012-05-07 16:04:31Z cdennis $

Field Summary

Modifier and TypeField and Description
public static final String
NAME

The name of this policy as a string literal

Inherited from net.sf.ehcache.store.AbstractPolicy:
DEFAULT_SAMPLE_SIZERANDOM

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the second element is preferable to the first element for ths policy
compare
(Element
the element to compare against
element1
,
Element
the element to compare
element2
)

Implements net.sf.ehcache.store.Policy.compare.

Compares the desirableness for eviction of two elements Compares hit counts.
public String

Returns:

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

Implements net.sf.ehcache.store.Policy.getName.

Inherited from net.sf.ehcache.store.AbstractPolicy:
calculateSampleSizegenerateRandomSampleselectedBasedOnPolicy

Field Detail

NAMEback to summary
public static final String NAME

The name of this policy as a string literal

Constructor Detail

LfuPolicyback to summary
public LfuPolicy()

Method Detail

compareback to summary
public boolean compare(Element element1, Element element2)

Implements net.sf.ehcache.store.Policy.compare.

Compares the desirableness for eviction of two elements Compares hit counts. If both zero,

Parameters
element1:Element

the element to compare against

element2:Element

the element to compare

Returns:boolean

true if the second element is preferable to the first element for ths policy

getNameback to summary
public String getName()

Implements net.sf.ehcache.store.Policy.getName.

Returns:String

the name of the Policy. Inbuilt examples are LRU, LFU and FIFO.