Class GetValueFromCache

All Implemented Interfaces:
AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, ConfigComment, ConnectedService, MessageEventGenerator, Service, StateManagedComponent

@ComponentProfile(summary="Retrieve a value from the configured cache", since="3.9.2", tag="service,cache", recommended=CacheConnection.class) public class GetValueFromCache extends SingleKeyValueCacheImpl
Version of RetrieveFromCacheService that doesn't use CacheEntryEvaluator.

Most of the time, you only want to retrieve 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 insert the value from the cache into the current message.

In the adapter configuration file this class is aliased as get-single-value-from-cache which is the preferred alternative to the fully qualified classname when building your configuration.

  • Constructor Details

    • GetValueFromCache

      public GetValueFromCache()
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Description copied from interface: Service

      Apply the service to the message.

      Parameters:
      msg - the AdaptrisMessage to process
      Throws:
      ServiceException - wrapping any underlying Exceptions
    • getExceptionIfNotFound

      public Boolean getExceptionIfNotFound()
    • setExceptionIfNotFound

      public void setExceptionIfNotFound(Boolean b)
      Whether or not to throw an exception if the key is not in the cache.
      Parameters:
      b - default is true
    • withExceptionIfNotFound

      public GetValueFromCache withExceptionIfNotFound(Boolean b)