dsto.dfc.collections.cache
Interface Cache

All Known Implementing Classes:
AbstractCache, CacheLRU

public interface Cache

An interface defining the basic functions of a cache.

Since:
1.0
Version:
@version@
Author:
Daniel F. Savarese

Method Summary
 int capacity()
          Returns the maximum number of elements that can be cached at one time.
 Object get(Object key)
           
 Object put(Object key, Object value)
          Put an object into the cache.
 int size()
          Returns the number of elements in the cache, not to be confused with the capacity()which returns the number of elements that can be held in the cache at one time.
 

Method Detail

put

Object put(Object key,
           Object value)
Put an object into the cache.

Parameters:
key - The key.
value - The value to cache.
Returns:
The object that this one replaced, if any, within the cache.

get

Object get(Object key)

size

int size()
Returns the number of elements in the cache, not to be confused with the capacity()which returns the number of elements that can be held in the cache at one time.

Returns:
The current size of the cache (i.e., the number of elements currently cached).

capacity

int capacity()
Returns the maximum number of elements that can be cached at one time.

Returns:
The maximum number of elements that can be cached at one time.


Copyright © 2008 Commonwealth of Australia