ch.elca.el4j.services.statistics.detailed.cache
Class LRUCache<K,E>

java.lang.Object
  extended by ch.elca.el4j.services.statistics.detailed.cache.LRUCache<K,E>
Type Parameters:
K - Generic type of Key.
E - Generic type of Element.

public class LRUCache<K,E>
extends Object

This class is a simple, generic FIFO Cache restricted to a certain size.

Author:
David Stefan (DST)
File-location:
LRUCache
Last check-in date:
2009-08-04 15:17:52 +0200 (Di, 04. Aug 2009) by swismer for revision 3880

Constructor Summary
LRUCache(int cacheSize)
          Creates a new LRU cache.
 
Method Summary
 void clear()
          Clear the cache.
 E get(K key)
          Get element out of cache.
 Collection<E> getAll()
          Get all elements of cache.
 Set<K> getKeys()
          Get all keys of bag.
 void put(K key, E element)
          Put element to cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUCache

public LRUCache(int cacheSize)
Creates a new LRU cache.

Parameters:
cacheSize - the maximum number of entries that will be kept in this cache.
Method Detail

put

public void put(K key,
                E element)
Put element to cache.

Parameters:
key - Key of element
element - Element to add

get

public E get(K key)
Get element out of cache.

Parameters:
key - Key of the element to get
Returns:
Element from cache

getAll

public Collection<E> getAll()
Get all elements of cache.

Returns:
Collection of all cache elements

getKeys

public Set<K> getKeys()
Get all keys of bag.

Returns:
key set of bag

clear

public void clear()
Clear the cache.



Copyright © 2005-2011 ELCA. All Rights Reserved.