T - the type of stored valuespublic class ExpirableCache<T> extends Object implements Serializable
| Constructor and Description |
|---|
ExpirableCache(long ttl) |
| Modifier and Type | Method and Description |
|---|---|
T |
get(String key,
ExpirableCacheRepopulator<T> populate)
Retrieves a value from the cache.
|
T |
get(String key,
long ttl,
ExpirableCacheRepopulator<T> populate)
Retrieves a value from the cache
|
T |
put(String key,
T value)
Puts a value in the cache.
|
T |
put(String key,
T value,
long ttl)
Puts a value in the cache.
|
public ExpirableCache(long ttl)
ttl - The default "Time to live" (ttl) for the entriespublic T put(String key, T value)
key - the entry keyvalue - the entry valuepublic T put(String key, T value, long ttl)
key - the entry keyvalue - the entry valuettl - a custom time to live for this entrypublic T get(String key, ExpirableCacheRepopulator<T> populate)
key - the key to retrievepopulate - the function to re-populate if the value is expired or non existentpublic T get(String key, long ttl, ExpirableCacheRepopulator<T> populate)
key - the key to retrievettl - the time to live in case the value is repopulatedpopulate - the function to re-populate if the value is expired or non existentCopyright © 2016–2017. All rights reserved.