Class InlineItemCache

  • All Implemented Interfaces:
    ComponentLifecycle, ProcessedItemCache
    Direct Known Subclasses:
    MarshallingItemCache

    public class InlineItemCache
    extends java.lang.Object
    implements ProcessedItemCache
    In memory cache of items that have been processed.

    In the adapter configuration file this class is aliased as fs-inline-processed-item-cache which is the preferred alternative to the fully qualified classname when building your configuration.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​ProcessedItem> cache  
      protected org.slf4j.Logger logR  
    • Constructor Summary

      Constructors 
      Constructor Description
      InlineItemCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the cache.
      void close()
      Closes the component.
      boolean contains​(java.lang.String key)
      Query the cache for this key.
      void evict()
      evict any items in the cache that require it..
      ProcessedItem get​(java.lang.String key)
      Get the TrackedItem associated with the key.
      TimeInterval getAgeBeforeEviction()  
      void init()
      Initialises the component.
      void save()
      Explicitly save the state of the cache.
      void setAgeBeforeEviction​(TimeInterval interval)
      Specify the age of an entry in the cache before it is evicted.
      int size()
      Return the number of items in the cache.
      void start()
      Starts the component.
      void stop()
      Stop the component
      void update​(ProcessedItem i)
      Update the cache with the tracked item.
      void update​(ProcessedItemList list)
      Update the cache with the associated list of entries.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        protected transient java.util.Map<java.lang.String,​ProcessedItem> cache
      • logR

        protected transient org.slf4j.Logger logR
    • Constructor Detail

      • InlineItemCache

        public InlineItemCache()
    • Method Detail

      • contains

        public boolean contains​(java.lang.String key)
        Description copied from interface: ProcessedItemCache
        Query the cache for this key.
        Specified by:
        contains in interface ProcessedItemCache
        Parameters:
        key - the key
        Returns:
        true if the item exists.
      • get

        public ProcessedItem get​(java.lang.String key)
        Description copied from interface: ProcessedItemCache
        Get the TrackedItem associated with the key.
        Specified by:
        get in interface ProcessedItemCache
        Parameters:
        key - the key
        Returns:
        the TrackedItem or null if it does not exist.
      • size

        public int size()
        Description copied from interface: ProcessedItemCache
        Return the number of items in the cache.
        Specified by:
        size in interface ProcessedItemCache
        Returns:
        the number of items in the cache.
      • close

        public void close()
        Description copied from interface: ComponentLifecycle
        Closes the component.

        A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException may cause unintended consequences

        Specified by:
        close in interface ComponentLifecycle
      • stop

        public void stop()
        Description copied from interface: ComponentLifecycle
        Stop the component

        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

        Specified by:
        stop in interface ComponentLifecycle
      • getAgeBeforeEviction

        public TimeInterval getAgeBeforeEviction()
      • setAgeBeforeEviction

        public void setAgeBeforeEviction​(TimeInterval interval)
        Specify the age of an entry in the cache before it is evicted.
        Parameters:
        interval - the time before eviction to set, default 12 hours