org.softamis.net.cache
Interface SimpleCache<K extends java.io.Serializable,V extends java.io.Serializable>

Type Parameters:
K - type of keys used to identify cache items
V - type of values stored in the cache
All Known Implementing Classes:
DefaultDistributedCache, DefaultDistributedCache, MapBasedCache

public interface SimpleCache<K extends java.io.Serializable,V extends java.io.Serializable>

Generic interface for simple distributed cache. Items placed into this cache will be distributed amount other instances of cache. NOTE this is specific case of using cache - items are not removed from cache individually.

Author:
Andrew Sazonov

Method Summary
 void clear()
          Clears cache content
 java.util.Set<K> getKeys()
          Returns set of keys for items stored in cache
 V getObject(K aKey)
          Returns object from cache for given key
 java.util.Set<V> getValues()
          Returns items stored in the cache
 void saveObject(K aKey, V aValue)
          Stores object in cache
 int size()
          Returns amount of items stored in cache
 void update(java.util.Map<K,V> aData)
          Updates content of cache by given values (old values will be removed)
 

Method Detail

saveObject

void saveObject(K aKey,
                V aValue)
Stores object in cache

Parameters:
aKey - key of object
aValue - item value

getObject

V getObject(K aKey)
Returns object from cache for given key

Parameters:
aKey - key of the object
Returns:
object stored in cache under given key, null if there is no item in the cache for given key

clear

void clear()
Clears cache content


update

void update(java.util.Map<K,V> aData)
Updates content of cache by given values (old values will be removed)

Parameters:
aData - new content of the cache

getValues

java.util.Set<V> getValues()
Returns items stored in the cache

Returns:
items stored int the cache

size

int size()
Returns amount of items stored in cache

Returns:
items count

getKeys

java.util.Set<K> getKeys()
Returns set of keys for items stored in cache

Returns:
set of keys