com.photoviewer.client.util
Class MRUCache

java.lang.Object
  extended bycom.photoviewer.client.util.MRUCache

public class MRUCache
extends java.lang.Object

MRUCache implements a "most recently used" cache.

Author:
John De Regnaucourt, 11/18/2003

Constructor Summary
MRUCache(int maxSize, int maxItemSize)
          Constructor
 
Method Summary
 void clear()
          Clear the cache.
 byte[] get(java.lang.String key)
          Get the value associated to the key from the cache.
 void put(java.lang.String key, byte[] value)
          Store a key-value pair in the MRUCache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MRUCache

public MRUCache(int maxSize,
                int maxItemSize)
Constructor

Parameters:
maxSize - int maximum capacity of this MRUCache.
Method Detail

put

public void put(java.lang.String key,
                byte[] value)
Store a key-value pair in the MRUCache. The newly stored item will be considered the MRU item.

Parameters:
key - String key used to index items in the cache.
value - the value associated to the key.

get

public byte[] get(java.lang.String key)
Get the value associated to the key from the cache. The item that is fetch will be considered the "most recently used."

Parameters:
key - String key used to index the items in the cache.
Returns:
the value associated to the key, or null if the object is not in the cache.

clear

public void clear()
Clear the cache.