|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.specrunner.util.cache.core.CacheLRU<K,T>
K - Key type.T - The cache object type.public class CacheLRU<K,T>
LRU implementation of a cache.
| Field Summary |
|---|
| Fields inherited from interface org.specrunner.util.cache.ICache |
|---|
DEFAULT_FEATURE_CLEAN, DEFAULT_FEATURE_SIZE, DEFAULT_FEATURE_TIMEOUT, FEATURE_CLEAN, FEATURE_SIZE, FEATURE_TIMEOUT |
| Constructor Summary | |
|---|---|
CacheLRU(String name,
ICacheCleaner<T> cleaner)
Basic constructor. |
|
| Method Summary | |
|---|---|
boolean |
contains(K key)
Says if a key is mapped. |
T |
get(K key)
Get a cache object. |
ICacheCleaner<T> |
getCleaner()
Get the cache cleaner. |
String |
getName()
Get the cache name. |
ICache<K,T> |
put(K key,
T value)
Put an element to the cache. |
void |
release()
Release cache. |
void |
remove(K key)
Remove an object from cache. |
ICache<K,T> |
setClean(long clean)
Set cache number of removed elements on cache overload. |
ICache<K,T> |
setCleaner(ICacheCleaner<T> cleaner)
Set the cleaner. |
ICache<K,T> |
setName(String name)
Set a cache name. |
ICache<K,T> |
setSize(long size)
Set cache max size. |
ICache<K,T> |
setTimeout(long timeout)
Set cache elements timeout. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheLRU(String name,
ICacheCleaner<T> cleaner)
name - The cache name.cleaner - A cleaner.| Method Detail |
|---|
public String getName()
ICache
getName in interface ICache<K,T>public ICache<K,T> setName(String name)
ICache
setName in interface ICache<K,T>name - A cache.
public ICacheCleaner<T> getCleaner()
ICache
getCleaner in interface ICache<K,T>public ICache<K,T> setCleaner(ICacheCleaner<T> cleaner)
ICache
setCleaner in interface ICache<K,T>cleaner - A cleaner.
public ICache<K,T> setTimeout(long timeout)
ICache
setTimeout in interface ICache<K,T>timeout - The timeout.
public ICache<K,T> setSize(long size)
ICache
setSize in interface ICache<K,T>size - The size.
public ICache<K,T> setClean(long clean)
ICache
setClean in interface ICache<K,T>clean - The number of items to be removed.
public boolean contains(K key)
ICache
contains in interface ICache<K,T>key - The key.
public T get(K key)
ICache
get in interface ICache<K,T>key - The object key.
public ICache<K,T> put(K key,
T value)
ICache
put in interface ICache<K,T>key - The key.value - The object value.
public void remove(K key)
ICache
remove in interface ICache<K,T>key - The key.public void release()
ICache
release in interface ICache<K,T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||