|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldengate.common.lru.AbstractLruCache<K,V>
public abstract class AbstractLruCache<K,V>
Base class for concrete implementations
Constructor Summary | |
---|---|
protected |
AbstractLruCache(long ttl)
Constructs BaseLruCache |
Method Summary | |
---|---|
boolean |
contains(K key)
Checks whether cache contains valid entry for key |
protected InterfaceLruCacheEntry<V> |
createEntry(V value,
long ttl)
Creates new LruCacheEntry |
V |
get(K key)
Returns value cached with key. |
V |
get(K key,
Callable<V> callback)
Tries to get element from cache. |
V |
get(K key,
Callable<V> callback,
long ttl)
Tries to get element from cache. |
protected abstract InterfaceLruCacheEntry<V> |
getEntry(K key)
Returns LruCacheEntry mapped by key or null if it does not exist |
long |
getTtl()
Returns cache TTL |
protected V |
getValue(K key)
Tries to retrieve value by it's key. |
boolean |
isEmpty()
Checks whether cache is empty. |
void |
put(K key,
V value)
Puts value under key into cache. |
void |
put(K key,
V value,
long ttl)
Puts value under key into cache with desired TTL |
protected abstract void |
putEntry(K key,
InterfaceLruCacheEntry<V> entry)
Puts entry into cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface goldengate.common.lru.InterfaceLruCache |
---|
clear, forceClearOldest, getCapacity, getSize, remove |
Constructor Detail |
---|
protected AbstractLruCache(long ttl)
ttl
-
IllegalArgumentException
- if ttl is not positiveMethod Detail |
---|
public boolean contains(K key)
InterfaceLruCache
contains
in interface InterfaceLruCache<K,V>
protected InterfaceLruCacheEntry<V> createEntry(V value, long ttl)
value
- ttl
-
public V get(K key)
InterfaceLruCache
get
in interface InterfaceLruCache<K,V>
public V get(K key, Callable<V> callback) throws Exception
InterfaceLruCache
get
in interface InterfaceLruCache<K,V>
Exception
- if callback throws exceptionpublic V get(K key, Callable<V> callback, long ttl) throws Exception
InterfaceLruCache
get
in interface InterfaceLruCache<K,V>
ttl
- time to live in milliseconds
Exception
- if callback throws exceptionpublic long getTtl()
InterfaceLruCache
getTtl
in interface InterfaceLruCache<K,V>
protected abstract InterfaceLruCacheEntry<V> getEntry(K key)
key
-
protected V getValue(K key)
key
-
public boolean isEmpty()
InterfaceLruCache
isEmpty
in interface InterfaceLruCache<K,V>
public void put(K key, V value)
InterfaceLruCache
put
in interface InterfaceLruCache<K,V>
public void put(K key, V value, long ttl)
InterfaceLruCache
put
in interface InterfaceLruCache<K,V>
ttl
- time to live in millisecondsprotected abstract void putEntry(K key, InterfaceLruCacheEntry<V> entry)
key
- entry
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |