org.yestech.cache.impl
Class MemcachedAsynchronousCacheManager<V>

java.lang.Object
  extended by org.yestech.cache.impl.MemcachedAsynchronousCacheManager<V>
All Implemented Interfaces:
ICacheManager<String,V>

public class MemcachedAsynchronousCacheManager<V>
extends Object
implements ICacheManager<String,V>

An implements of an asynchronous cache using Memcached using the Spy Client.


Constructor Summary
MemcachedAsynchronousCacheManager()
           
 
Method Summary
 boolean contains(String k)
          Checks is a Key is present in the cache.
 void flush(String key)
          Flush the Value associated with the Key from the Cache
 void flushAll()
          Flushes the entire cache
 V get(String key)
          Return the Value associated with the Key
 net.spy.memcached.MemcachedClient getCache()
           
 int getExpireTime()
           
 Collection<String> keys()
          Returns all the Keys found in the Cache.
 void load()
          Loads a cache from some type of durable storage.
 void put(org.yestech.lib.util.Pair<String,V> entry)
          Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.
 void put(String k, V v)
          Puts a Key/Value into the cache, overriding any value the might already be associated with the Key.
 void putAll(Map<String,V> collection)
          Puts a Collection of Key/Value Pairs into the cache.
 void setCache(net.spy.memcached.MemcachedClient cache)
           
 void setExpireTime(int expireTime)
           
 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

MemcachedAsynchronousCacheManager

public MemcachedAsynchronousCacheManager()
Method Detail

getExpireTime

public int getExpireTime()

setExpireTime

public void setExpireTime(int expireTime)

getCache

public net.spy.memcached.MemcachedClient getCache()

setCache

public void setCache(net.spy.memcached.MemcachedClient cache)

contains

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

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

putAll

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

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

put

public void put(org.yestech.lib.util.Pair<String,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<String,V>
Parameters:
entry - Key and Value pair to add (Key is Pair.getFirst() and Value is Pair.getSecond().

put

public void put(String 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<String,V>
Parameters:
k - Key that the value will be associated by
v - Value to be cached

get

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

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

flush

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

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

keys

public Collection<String> 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<String,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<String,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<String,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<String,V>


Copyright © 2010 YES Technology Association. All Rights Reserved.