freemarker.ext.util
Class CacheMapLRU<K,V>

java.lang.Object
  extended by freemarker.ext.util.CacheMapLRU<K,V>

public class CacheMapLRU<K,V>
extends java.lang.Object

A simple cache of fixed size that implements a least recently used algorithm. The access is unsyncrhonized. The default capacity of the cache is of ten items. Attempts to store more than ten unique keys will result in the least recently used item being evicted, and the new item inserted in its place. Keys are assumed to always be non-null values.

Since:
1.9
Version:
$Id: CacheMapLRU.java 1090 2013-03-29 11:04:07Z run2000 $
Author:
Nicholas Cull

Field Summary
static int DEFAULT_CAPACITY
           
 
Constructor Summary
CacheMapLRU()
           
CacheMapLRU(int capacity)
           
 
Method Summary
 void clear()
           
 V get(K key)
           
 void put(K key, V value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY
See Also:
Constant Field Values
Constructor Detail

CacheMapLRU

public CacheMapLRU()

CacheMapLRU

public CacheMapLRU(int capacity)
Method Detail

get

public V get(K key)

put

public void put(K key,
                V value)

clear

public void clear()