public interface Cache extends ComponentLifecycle
Modifier and Type | Method and Description |
---|---|
default void |
clear()
Clears all entries from the cache
|
default void |
close()
Closes the component.
|
java.lang.Object |
get(java.lang.String key)
Retrieves an object from the cache
|
default java.util.List<java.lang.String> |
getKeys()
Retrieves a List of all the keys in the cache
|
default void |
init()
Initialises the component.
|
default void |
put(java.lang.String key,
java.lang.Object value)
Puts any object into the cache.
|
void |
put(java.lang.String key,
java.io.Serializable value)
Puts a serializable object into the cache.
|
void |
remove(java.lang.String key)
Removes an object from the cache.
|
default int |
size() |
default void |
start()
Starts the component.
|
default void |
stop()
Stop the component
|
void put(java.lang.String key, java.io.Serializable value) throws CoreException
key
- key to store the value againstvalue
- value to be storedCoreException
- if there was an exception accessing the cache.default void put(java.lang.String key, java.lang.Object value) throws CoreException
Not guaranteed to be supported by all cache implementations as some persistent caches require serialization.
key
- key to store the value againstvalue
- value to be storedjava.lang.UnsupportedOperationException
- if the put(String,Object)
operation is not supported by this cache instanceCoreException
- if there was an exception accessing the cache.UnsupportedOperationException
and performs no other action.java.lang.Object get(java.lang.String key) throws CoreException
key
- the key to look up the objectCoreException
- if there was an exception accessing the cache.void remove(java.lang.String key) throws CoreException
key
- the key to locate the object in the cacheCoreException
- if there was an exception accessing the cache.default java.util.List<java.lang.String> getKeys() throws CoreException
java.lang.UnsupportedOperationException
- if the getKeys
operation is not supported by this cache instanceCoreException
- if there was an exception accessing the cache.UnsupportedOperationException
and performs no other action.default void clear() throws CoreException
java.lang.UnsupportedOperationException
- if the clear
operation is not supported by this cache instanceCoreException
- if there was an exception accessing the cache.UnsupportedOperationException
and performs no other action.default int size() throws CoreException
java.lang.UnsupportedOperationException
- if the size
operation is not supported by this cache instanceCoreException
- if there was an exception accessing the cache.UnsupportedOperationException
and performs no other action.default void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
sdefault void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
sdefault void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
default void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle