public interface LocalCache
Modifier and Type | Interface and Description |
---|---|
static interface |
LocalCache.Element
Use to enrich object with meta-data
(help to choice if attached object has to be removed from cache)
|
Modifier and Type | Method and Description |
---|---|
<T> T |
computeIfAbsent(Class<T> expectedClass,
String key,
long timeoutMs,
Supplier<T> value)
Read or compute and save a value for a determined duration.
|
<T> T |
computeIfAbsent(Class<T> expectedClass,
String key,
Predicate<LocalCache.Element> toRemove,
long timeoutMs,
Supplier<T> value)
Read or compute and save a value for a determined duration and predicate.
|
<T> T |
computeIfAbsent(Class<T> expectedClass,
String key,
Predicate<LocalCache.Element> toRemove,
Supplier<T> value)
Read or compute and save a value until remove predicate go to remove.
|
<T> T |
computeIfAbsent(Class<T> expectedClass,
String key,
Supplier<T> value)
Compute and save a value, if key not present, for undetermined duration.
|
void |
evict(String key)
Remove a cached entry.
|
void |
evictIfValue(String key,
Object expected)
Remove a cached entry if a particular value is in the cache.
|
<T> T computeIfAbsent(Class<T> expectedClass, String key, Predicate<LocalCache.Element> toRemove, long timeoutMs, Supplier<T> value)
T
- class of cached instance.expectedClass
- : cached instance class.key
- : the cache key, must be unique accross the server.toRemove
- : is the object to be removed.timeoutMs
- : duration of cache value.value
- : the value provider if the cache get does a miss.<T> T computeIfAbsent(Class<T> expectedClass, String key, Predicate<LocalCache.Element> toRemove, Supplier<T> value)
T
- class of cached instance.expectedClass
- : cached instance class.key
- : the cache key, must be unique accross the server.toRemove
- : is the object to be removed.value
- : the value provider if the cache get does a miss.<T> T computeIfAbsent(Class<T> expectedClass, String key, long timeoutMs, Supplier<T> value)
T
- class of cached instance.expectedClass
- : cached instance class.key
- : the cache key, must be unique accross the server.timeoutMs
- : duration of cache value.value
- : value provider.<T> T computeIfAbsent(Class<T> expectedClass, String key, Supplier<T> value)
T
- class of cached instance.expectedClass
- : cached instance class.key
- : the cache key, must be unique accross the server.value
- : value provider.void evictIfValue(String key, Object expected)
key
- key to evict.expected
- expected value activating the eviction.1.1.20-SNAPSHOT - Copyright © 2019 Talend Component Kit Documentation