K - the keyV - the valuepublic interface ILRUCache<K,V extends Closeable>
| Modifier and Type | Method and Description |
|---|---|
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.
|
void put(K key, V value, long ttlInMilliSeconds)
key - the key of the cached resourcevalue - the to be cached resourcettlInMilliSeconds - time to live in millisecondsvoid put(K key, V value)
key - the key of the cached resourcevalue - the to be cached resourceV get(K key)
key - the key of the cached resourcevoid release(K key)
key - key of resource to releaseV remove(K key) throws IOException
key - the key of the cached resourceIOException - exception thrown if there is any IO errorvoid removeAll()
throws IOException
IOException - exception thrown if there is any IO errorint size()
Collection<V> getValues()
Copyright © 2020. All rights reserved.