de.smartics.properties.spi.config.cache
Class AmnesiaCache<K,V>

Package class diagram package AmnesiaCache
java.lang.Object
  extended by de.smartics.properties.spi.config.cache.AmnesiaCache<K,V>
Type Parameters:
K - type of the key.
V - type of the value.
All Implemented Interfaces:
Cache<K,V>, UnawareCache<K,V>

@ThreadSafe
public final class AmnesiaCache<K,V>
     
     
extends Object
implements Cache<K,V>

Fake implementation of a cache.


Constructor Summary
AmnesiaCache()
           
 
Method Summary
 V get(Object key)
          Returns the value from the cache for the given key.
 Set<K> keySet()
          Returns a set of all keys in the cache.
 void put(K key, V value)
          Put the given value in the cache under the given key.
 void put(K key, V value, int lifespan, TimeUnit lifespanTimeUnit, int maxIdleTime, TimeUnit maxIdleTimeTimeUnit)
          Put the given value with the given properties in the cache under the given key.
 void put(K key, V value, long updateIntervalInMs, TimeUnit milliseconds)
          Put the given value with the given properties in the cache under the given key.
 V remove(Object key)
          Removes the value for the given key.
 long size()
          Fetch the size of the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AmnesiaCache

public AmnesiaCache()
Method Detail

size

public long size()
Description copied from interface: Cache
Fetch the size of the cache.

Specified by:
size in interface Cache<K,V>
Returns:
the number of elements in the cache.

get

public V get(Object key)
Description copied from interface: UnawareCache
Returns the value from the cache for the given key.

Specified by:
get in interface UnawareCache<K,V>
Parameters:
key - the key to retrieve a value for.
Returns:
the stored value for the given key.

put

public void put(K key,
                V value)
Description copied from interface: UnawareCache
Put the given value in the cache under the given key.

Specified by:
put in interface UnawareCache<K,V>
Parameters:
key - the key to store the value.
value - the value.

put

public void put(K key,
                V value,
                long updateIntervalInMs,
                TimeUnit milliseconds)
Description copied from interface: UnawareCache
Put the given value with the given properties in the cache under the given key.

Specified by:
put in interface UnawareCache<K,V>
Parameters:
key - the key to store the value.
value - the value.
updateIntervalInMs - alue.the update time.
milliseconds - the time unit.

put

public void put(K key,
                V value,
                int lifespan,
                TimeUnit lifespanTimeUnit,
                int maxIdleTime,
                TimeUnit maxIdleTimeTimeUnit)
Description copied from interface: UnawareCache
Put the given value with the given properties in the cache under the given key.

Specified by:
put in interface UnawareCache<K,V>
Parameters:
key - the key to store the value.
value - the value.
lifespan - lifespan
lifespanTimeUnit - lifespanTimeUnit
maxIdleTime - maxIdleTime
maxIdleTimeTimeUnit - maxIdleTimeTimeUnit

remove

public V remove(Object key)
Description copied from interface: UnawareCache
Removes the value for the given key.

Specified by:
remove in interface UnawareCache<K,V>
Parameters:
key - the key for which the value shall be removed.
Returns:
the removed v

keySet

public Set<K> keySet()
Description copied from interface: Cache
Returns a set of all keys in the cache.

Specified by:
keySet in interface Cache<K,V>
Returns:
the set of all keys.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.