org.apache.jackrabbit.mk.util
Class Cache<K,V extends Cache.Value>

java.lang.Object
  extended by org.apache.jackrabbit.mk.util.Cache<K,V>

public class Cache<K,V extends Cache.Value>
extends Object


Nested Class Summary
static interface Cache.Backend<K,V>
          A cache backend that can load objects from persistent storage.
static interface Cache.Value
          A cacheable object.
 
Method Summary
 void clear()
           
 V get(K key)
           
 int getMemoryMax()
           
 int getMemoryUsed()
           
static
<K,V extends Cache.Value>
Cache<K,V>
newInstance(Cache.Backend<K,V> backend, int maxMemoryBytes)
           
 void put(K key, V value)
           
 V replace(K key, V value)
          Get the element in the cache if one exists, or add it to the cache if not.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

put

public void put(K key,
                V value)

replace

public V replace(K key,
                 V value)
Get the element in the cache if one exists, or add it to the cache if not.

Parameters:
key - the key
value - the value
Returns:
the cached element

get

public V get(K key)

newInstance

public static <K,V extends Cache.Value> Cache<K,V> newInstance(Cache.Backend<K,V> backend,
                                                               int maxMemoryBytes)

clear

public void clear()

size

public int size()

getMemoryUsed

public int getMemoryUsed()

getMemoryMax

public int getMemoryMax()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.