public interface StorageService
| Modifier and Type | Method and Description |
|---|---|
void |
clear(java.lang.Class<?> itemClass)
Clears all items of the given item class.
|
void |
clearAll()
Clears all items from the storage service.
|
boolean |
exists(java.lang.Class<?> itemClass,
java.lang.Object key)
Indicates whether an item exists under the given item class and key.
|
<V> V |
get(java.lang.Class<V> itemClass,
java.lang.Object key)
Gets an item stored in the storage service.
|
<K,V> @Nullable java.util.Map<K,V> |
getEntries(java.lang.Class<V> itemClass) |
<V> void |
registerItemClassIfAbsent(java.lang.Class<V> itemClass,
boolean isRenewableExpiration,
long timeToLiveNanos,
@Nullable ShouldDisposeFunc<V> shouldDisposeFunc,
@Nullable ItemDisposalFunc<V> itemDisposalFunc)
Registers a new item class with the storage service.
|
void |
remove(java.lang.Class<?> itemClass,
java.lang.Object key)
Removes an item stored under the given item class.
|
<V> void |
set(java.lang.Object key,
V item)
Stores an item in the storage service under the given item class.
|
int |
size(java.lang.Class<?> itemClass) |
<V> void registerItemClassIfAbsent(java.lang.Class<V> itemClass,
boolean isRenewableExpiration,
long timeToLiveNanos,
@Nullable ShouldDisposeFunc<V> shouldDisposeFunc,
@Nullable ItemDisposalFunc<V> itemDisposalFunc)
V - the type of item that will be stored under the item class.itemClass - the class of the item that will be stored, eg `CustomEndpointInfo.class`.isRenewableExpiration - controls whether the item's expiration should be renewed if the item is fetched,
regardless of whether it is already expired or not.timeToLiveNanos - how long an item should be stored before being considered expired, in nanoseconds.shouldDisposeFunc - a function defining whether an item should be disposed if expired. If null is passed,
the item will always be disposed if expired.itemDisposalFunc - a function defining how to dispose of an item when it is removed. If null is
passed, the item will be removed without performing any additional operations.<V> void set(java.lang.Object key,
V item)
V - the type of the item being retrieved.key - the key for the item, eg "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".item - the item to store.<V> V get(java.lang.Class<V> itemClass,
java.lang.Object key)
V - the type of the item being retrieved.itemClass - the expected class of the item being retrieved, eg `CustomEndpointInfo.class`.key - the key for the item, eg "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".boolean exists(java.lang.Class<?> itemClass,
java.lang.Object key)
itemClass - the class of the item.key - the key for the item, eg "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".void remove(java.lang.Class<?> itemClass,
java.lang.Object key)
itemClass - the class of the item.key - the key for the item, eg "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".void clear(java.lang.Class<?> itemClass)
itemClass - the class of the items to clear.void clearAll()
<K,V> @Nullable java.util.Map<K,V> getEntries(java.lang.Class<V> itemClass)
int size(java.lang.Class<?> itemClass)