org.apache.shindig.common.cache
Interface Cache<K,V>

All Known Implementing Classes:
EhConfiguredCache, LruCache, NullCache

public interface Cache<K,V>

A basic cache interface. If necessary, we can always move to the commons cache for the future.


Method Summary
 void addElement(K key, V value)
          Stores an entry into the cache.
 long getCapacity()
          Returns the capacity of the cache.
 V getElement(K key)
          Retrieves an entry for the cache.
 long getSize()
           
 V removeElement(K key)
          Removes an entry from the cache.
 

Method Detail

getElement

V getElement(K key)
Retrieves an entry for the cache.

Returns:
The entry stored under the given key, or null if it doesn't exist.

addElement

void addElement(K key,
                V value)
Stores an entry into the cache.


removeElement

V removeElement(K key)
Removes an entry from the cache.

Parameters:
key - The entry to return.
Returns:
The entry stored under the given key, or null if it doesn't exist.

getCapacity

long getCapacity()
Returns the capacity of the cache.

Returns:
a positive integer indicating the upper bound on the number of allowed elements in the cace, -1 signifies that the capacity is unbounded

getSize

long getSize()
Returns:
The current size of the cache, or -1 if the cache does not support returning sizes.


Copyright © 2007-2012. All Rights Reserved.