public class TimeoutFIFOCache<K,V> extends Object
LinkedHashMap. If any element spends more time than the given timeout,
It will be automatically remove from the map. This map will also maintain the order of insertion in FIFO mode.| Constructor and Description |
|---|
TimeoutFIFOCache(long timeOut)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the whole cache.
|
V |
get(K key)
Get the value mapped with the given key.
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
List<V> |
refreshCache()
Remove all the time-out entry.
|
int |
size()
Return the size of this cache.
|
public TimeoutFIFOCache(long timeOut)
timeOut - Maximum allowed time in millisecond of an element to be in this map.
When the elements become older than the given timeout it will automatically be removed
on next call of refreshCache().public V get(K key)
key - Value will be searched using this key.public V put(K key, V value)
key - – key with which the specified value is to be associatedvalue - – value to be associated with the specified keypublic int size()
public void clear()
Copyright © 2024. All rights reserved.