Class FlushMap<K,​V>

  • Type Parameters:
    K - Key class
    V - Value class
    All Implemented Interfaces:
    Serializable, Cloneable, Map<K,​V>

    public class FlushMap<K,​V>
    extends HashMap<K,​V>
    A map which will be flushed after a certain time or when it reaches a certain size.
    Author:
    douglm
    See Also:
    Serialized Form
    • Constructor Detail

      • FlushMap

        public FlushMap()
        Create a FlushMap with default maxize and flush period.
      • FlushMap

        public FlushMap​(int size)
        Create a FlushMap with given size, default maxize and flush period.
        Parameters:
        size - initial size
      • FlushMap

        public FlushMap​(long flushTime,
                        int maxSize)
        Create a FlushMap with default size and specified maxsize and flush period.
        Parameters:
        flushTime - millis - 0 means no flush time
        maxSize - - 0 means no max size
      • FlushMap

        public FlushMap​(int size,
                        long flushTime,
                        int maxSize)
        Create a FlushMap with specified size, maxsize and flush period.
        Parameters:
        size - initial size
        flushTime - millis - 0 means no flush time
        maxSize - - 0 means no max size
    • Method Detail

      • testFlush

        protected boolean testFlush()
        Override this to modify the behavior - perhaps to preserve some special entries.
        Returns:
        true if we flushed.
      • put

        public V put​(K key,
                     V val)
        Specified by:
        put in interface Map<K,​V>
        Overrides:
        put in class HashMap<K,​V>