K - keyV - valuepublic class LRUCacheImpl<K,V extends Closeable> extends Object implements ILRUCache<K,V>
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TTL |
| Constructor and Description |
|---|
LRUCacheImpl(Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
static void |
CloseExecutorService()
Shutdown the internal ExecutorService,
Call this only after you have closed your bigqueue instance.
|
V |
get(K key)
Get a cached resource with specific key
This call will increment the reference counter of the keyed resource.
|
Collection<V> |
getValues()
All values cached
|
void |
put(K key,
V value)
Put a keyed resource with default ttl into the cache
This call will increment the reference counter of the keyed resource.
|
void |
put(K key,
V value,
long ttlInMilliSeconds)
Put a keyed resource with specific ttl into the cache
This call will increment the reference counter of the keyed resource.
|
void |
release(K key)
Release the cached resource with specific key
This call will decrement the reference counter of the keyed resource.
|
V |
remove(K key)
Remove the resource with specific key from the cache and close it synchronously afterwards.
|
void |
removeAll()
Remove all cached resource from the cache and close them asynchronously afterwards.
|
int |
size()
The size of the cache, equals to current total number of cached resources.
|
public static final long DEFAULT_TTL
public LRUCacheImpl(Clock clock)
public static void CloseExecutorService()
public void put(K key, V value, long ttlInMilliSeconds)
ILRUCachepublic void put(K key, V value)
ILRUCachepublic V get(K key)
ILRUCachepublic void release(K key)
ILRUCachepublic int size()
ILRUCachepublic void removeAll()
throws IOException
ILRUCachepublic V remove(K key) throws IOException
ILRUCacheCopyright © 2022. All rights reserved.