@ComponentProfile(summary="Add a single key/value to the configured cache cache", since="3.9.2", tag="service,cache", recommended=CacheConnection.class) public class AddValueToCache extends SingleKeyValueCacheImpl
AddToCacheService
that doesn't use CacheEntryEvaluator
.
Most of the time, you only want to add a single item to the cache rather than a list of items;
this simplified service allows you to do just that. It does not have a list of entries that are
evaluated, you simply specify a key and a CacheValueTranslator
which is used to extract
the value for storing in the cache; no checking is done of the resulting serializable-ness (or
not) of the value, it is simply inserted into the cache.
In the adapter configuration file this class is aliased as add-single-value-to-cache which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
AddValueToCache() |
Modifier and Type | Method and Description |
---|---|
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.String |
getExpiry() |
void |
setExpiry(java.lang.String s)
Set the cache expiry for any value added to the cache (if any).
|
<T extends AddValueToCache> |
withExpiry(java.lang.String s) |
getValueTranslator, prepare, setValueTranslator, withValueTranslator
getKey, setKey, withKey
closeService, getConnection, initService, retrieveCache, setConnection, start, stop, withConnection
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, isBranching, setUniqueId
createName, createQualifier, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init
getLookupName
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic <T extends AddValueToCache> T withExpiry(java.lang.String s)
public java.lang.String getExpiry()
public void setExpiry(java.lang.String s)
The rules once the value has been resolved are :
System.currentTimeMillis()
then it is treated as relative to now()
;
expiry is in millisecondsSystem.currentTimeMillis()
then it is treated as absolute; expiry is in
millisecondsDateFormatUtil.parse(String)
then it is treated as absolutes
- the expiry, which supports the %message{}
syntax to resolve metadata.