org.yestech.cache.impl
Class ConcurrentMapCacheManager<K,V>

java.lang.Object
  extended by org.yestech.cache.impl.ConcurrentMapCacheManager<K,V>
All Implemented Interfaces:
ICacheManager<K,V>
Direct Known Subclasses:
ConcurrentHashMapCacheManager, ConcurrentSkipListMapCacheManager, NonBlockingIdentityMapCacheManager, NonBlockingLongMapCacheManager, NonBlockingMapCacheManager

public class ConcurrentMapCacheManager<K,V>
extends Object
implements ICacheManager<K,V>

Cache Manager for ConcurrentMap

Version:
$Revision: $
Author:
Artie Copeland

Constructor Summary
ConcurrentMapCacheManager()
           
 
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
 ConcurrentMap getCache()
           
 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 setCache(ConcurrentMap cache)
           
 void store()
          Stores a cache to some type of durable storage.
 Collection<V> values()
          Returns all the values stored in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentMapCacheManager

public ConcurrentMapCacheManager()
Method Detail

getCache

public ConcurrentMap getCache()

setCache

public void setCache(ConcurrentMap cache)

contains

public boolean contains(K k)
Description copied from interface: ICacheManager
Checks is a Key is present in the cache.

Specified by:
contains in interface ICacheManager<K,V>
Parameters:
k - the Key to check
Returns:
true if present, else false

putAll

public void putAll(Map<K,V> collection)
Description copied from interface: ICacheManager
Puts a Collection of Key/Value Pairs into the cache.

Specified by:
putAll in interface ICacheManager<K,V>
Parameters:
collection - Collection of Keys/Values to add

put

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

Specified by:
put in interface ICacheManager<K,V>
Parameters:
entry - Key and Value pair to add (Key is Pair.getFirst() and Value is Pair.getSecond().

put

public void put(K k,
                V v)
Description copied from interface: ICacheManager
Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.

Specified by:
put in interface ICacheManager<K,V>
Parameters:
k - Key that the value will be associated by
v - Value to be cached

get

public V get(K key)
Description copied from interface: ICacheManager
Return the Value associated with the Key

Specified by:
get in interface ICacheManager<K,V>
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

public void flushAll()
Description copied from interface: ICacheManager
Flushes the entire cache

Specified by:
flushAll in interface ICacheManager<K,V>

flush

public void flush(K key)
Description copied from interface: ICacheManager
Flush the Value associated with the Key from the Cache

Specified by:
flush in interface ICacheManager<K,V>
Parameters:
key - Key to flush

keys

public Collection<K> keys()
Description copied from interface: ICacheManager
Returns all the Keys found in the Cache. Depending on the Concrete cache duplicates might be possible.

Specified by:
keys in interface ICacheManager<K,V>
Returns:
All the keys as a collection

values

public Collection<V> values()
Description copied from interface: ICacheManager
Returns all the values stored in the cache. Depending on the Concrete cache duplicates might be possible.

Specified by:
values in interface ICacheManager<K,V>
Returns:
All the values in the cache as a collection.

store

public 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.

Specified by:
store in interface ICacheManager<K,V>

load

public 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.

Specified by:
load in interface ICacheManager<K,V>


Copyright © 2010 YES Technology Association. All Rights Reserved.