|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface InterfaceLruCache<K,V>
LRU cache interface.
Method Summary | |
---|---|
void |
clear()
Removes all entries from cache |
boolean |
contains(K key)
Checks whether cache contains valid entry for key |
void |
forceClearOldest()
Removes all oldest entries from cache (ttl based) |
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. |
int |
getCapacity()
Returns cache capacity |
int |
getSize()
Returns number of entries stored in cache (including invalid ones) |
long |
getTtl()
Returns cache TTL |
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 |
void |
remove(K key)
Removes entry from cache (if exists) |
Method Detail |
---|
void clear()
void forceClearOldest()
boolean contains(K key)
key
-
V get(K key)
key
-
V get(K key, Callable<V> callback) throws Exception
key
- callback
-
Exception
- if callback throws exceptionV get(K key, Callable<V> callback, long ttl) throws Exception
key
- callback
- ttl
- time to live in milliseconds
Exception
- if callback throws exceptionint getCapacity()
int getSize()
long getTtl()
boolean isEmpty()
void put(K key, V value)
key
- value
- void put(K key, V value, long ttl)
key
- value
- ttl
- time to live in millisecondsvoid remove(K key)
key
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |