org.nnsoft.sameas4j.cache
Class InMemoryCache

java.lang.Object
  extended by org.nnsoft.sameas4j.cache.InMemoryCache
All Implemented Interfaces:
Cache

public final class InMemoryCache
extends Object
implements Cache

An in-memory based Cache implementation.


Constructor Summary
InMemoryCache()
           
 
Method Summary
<T> T
get(CacheKey cacheKey, Class<T> type)
          Retrieves an object from the cache.
<T> void
put(CacheKey cacheKey, T cacheValue)
          Add a new entry in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryCache

public InMemoryCache()
Method Detail

get

public <T> T get(CacheKey cacheKey,
                 Class<T> type)
Retrieves an object from the cache.

Specified by:
get in interface Cache
Type Parameters:
T - The stored object type
Parameters:
cacheKey - The cache key
type - The stored object
Returns:
The stored object if any, null otherwise

put

public <T> void put(CacheKey cacheKey,
                    T cacheValue)
Add a new entry in the cache.

Specified by:
put in interface Cache
Type Parameters:
T - The stored object type
Parameters:
cacheKey - The cache key
cacheValue - The stored object


Copyright © 2009-2012 99 Software Foundation. All Rights Reserved.