org.yestech.cache
Interface ICacheManager<K,V>

Type Parameters:
K - Type of Keys stored in the cache
V - Type of Values stored in the cache
All Known Implementing Classes:
ConcurrentHashMapCacheManager, ConcurrentMapCacheManager, ConcurrentSkipListMapCacheManager, EhCacheCacheManager, HashMapCacheManager, InfinispanCacheManager, JCSCacheManager, MapCacheManager, MemcachedAsynchronousCacheManager, MemcachedSynchronousCacheManager, NonBlockingIdentityMapCacheManager, NonBlockingLongMapCacheManager, NonBlockingMapCacheManager, TerracottaCacheManager, TerracottaDistributedCacheManager, TreeMapCacheManager

public interface ICacheManager<K,V>

Provides a encapsulated view to concrete Caching technologies. By binding to this Interface concrete Caching technologies are completely pluggable.

Version:
$Revision: $
Author:
Artie Copeland

Method Summary
 boolean contains(K k)
          Checks is a Key is present in the cache.
 void flush(K key)
          Flush the Value associated with the Key from the Cache
 void flushAll()
          Flushes the entire cache
 V get(K key)
          Return the Value associated with the Key
 Collection<K> keys()
          Returns all the Keys found in the Cache.
 void load()
          Loads a cache from some type of durable storage.
 void put(K k, V v)
          Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.
 void put(org.yestech.lib.util.Pair<K,V> entry)
          Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.
 void putAll(Map<K,V> collection)
          Puts a Collection of Key/Value Pairs into the cache.
 void store()
          Stores a cache to some type of durable storage.
 Collection<V> values()
          Returns all the values stored in the cache.
 

Method Detail

contains

boolean contains(K k)
Checks is a Key is present in the cache.

Parameters:
k - the Key to check
Returns:
true if present, else false

put

void put(org.yestech.lib.util.Pair<K,V> entry)
Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.

Parameters:
entry - Key and Value pair to add (Key is Pair.getFirst() and Value is Pair.getSecond().

put

void put(K k,
         V v)
Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.

Parameters:
k - Key that the value will be associated by
v - Value to be cached

putAll

void putAll(Map<K,V> collection)
Puts a Collection of Key/Value Pairs into the cache.

Parameters:
collection - Collection of Keys/Values to add

get

V get(K key)
Return the Value associated with the Key

Parameters:
key - Key to lookup
Returns:
The value, else null if no value is associated with the Key or the Key is not found

flushAll

void flushAll()
Flushes the entire cache


flush

void flush(K key)
Flush the Value associated with the Key from the Cache

Parameters:
key - Key to flush

keys

Collection<K> keys()
Returns all the Keys found in the Cache. Depending on the Concrete cache duplicates might be possible.

Returns:
All the keys as a collection

values

Collection<V> values()
Returns all the values stored in the cache. Depending on the Concrete cache duplicates might be possible.

Returns:
All the values in the cache as a collection.

store

@PreDestroy
void store()
Stores a cache to some type of durable storage. Not gaurenteed to be implemented, dependant on the concrete implementation. This method should perform a NoOp if it is not supported.


load

@PostConstruct
void load()
Loads a cache from some type of durable storage. Not gaurenteed to be implemented, dependant on the concrete implementation. This method should perform a NoOp if it is not supported.



Copyright © 2010 YES Technology Association. All Rights Reserved.