ch.bind.philib.cache
Class StagedCache<K,V>

java.lang.Object
  extended by ch.bind.philib.cache.StagedCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public final class StagedCache<K,V>
extends Object
implements Cache<K,V>


Field Summary
static int DEFAULT_CACHE_CAPACITY
          The default capacity of an object cache.
static int DEFAULT_OLD_GEN_AFTER_HITS
           
static double DEFAULT_OLD_GEN_RATIO
          The default capacity of an object cache.
static int MIN_CACHE_CAPACITY
          The minimum capacity of a staged cache.
 
Constructor Summary
StagedCache()
           
StagedCache(int capacity)
           
StagedCache(int capacity, Cloner<V> valueCloner)
           
StagedCache(int capacity, Cloner<V> valueCloner, double oldGenRatio, int oldGenAfterHits)
           
 
Method Summary
 void add(K key, V value)
          Add a key-value-pair to the cache.
 int capacity()
           
 void clear()
          Remove all elements from the cache.
 V get(K key)
          Query a value from the cache by its key.
 void remove(K key)
          Remove a key-value-pair from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_CACHE_CAPACITY

public static final int MIN_CACHE_CAPACITY
The minimum capacity of a staged cache.

See Also:
Constant Field Values

DEFAULT_CACHE_CAPACITY

public static final int DEFAULT_CACHE_CAPACITY
The default capacity of an object cache.

See Also:
Constant Field Values

DEFAULT_OLD_GEN_RATIO

public static final double DEFAULT_OLD_GEN_RATIO
The default capacity of an object cache.

See Also:
Constant Field Values

DEFAULT_OLD_GEN_AFTER_HITS

public static final int DEFAULT_OLD_GEN_AFTER_HITS
See Also:
Constant Field Values
Constructor Detail

StagedCache

public StagedCache()

StagedCache

public StagedCache(int capacity)

StagedCache

public StagedCache(int capacity,
                   Cloner<V> valueCloner)

StagedCache

public StagedCache(int capacity,
                   Cloner<V> valueCloner,
                   double oldGenRatio,
                   int oldGenAfterHits)
Method Detail

add

public void add(K key,
                V value)
Description copied from interface: Cache
Add a key-value-pair to the cache.

Specified by:
add in interface Cache<K,V>

get

public V get(K key)
Description copied from interface: Cache
Query a value from the cache by its key.

Specified by:
get in interface Cache<K,V>
Returns:
null if no value for the given key was found. Otherwise the value for this key.

remove

public void remove(K key)
Description copied from interface: Cache
Remove a key-value-pair from the cache.

Specified by:
remove in interface Cache<K,V>

capacity

public int capacity()
Specified by:
capacity in interface Cache<K,V>
Returns:
the capacity of this cache.

clear

public void clear()
Description copied from interface: Cache
Remove all elements from the cache.

Specified by:
clear in interface Cache<K,V>


Copyright © 2013. All Rights Reserved.