Class DataCache<T>


  • public class DataCache<T>
    extends java.lang.Object
    General purpose managed data cache
    • Constructor Summary

      Constructors 
      Constructor Description
      DataCache​(int maxSize, int expiresAfter)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear all data from cache
      T get​(java.lang.String key)
      Get data from cache
      void put​(java.lang.String key, T data)
      Put data in cache
      void remove​(java.lang.String key)
      Remove data from cache
      long size()
      Get data cache size
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataCache

        public DataCache​(int maxSize,
                         int expiresAfter)
        Constructor
        Parameters:
        maxSize - Cache max size (-1 means no limit)
        expiresAfter - Cache expiration delay (-1 means no limit)
    • Method Detail

      • put

        public void put​(java.lang.String key,
                        T data)
        Put data in cache
        Parameters:
        key - Key
        data - Data
      • get

        public T get​(java.lang.String key)
        Get data from cache
        Parameters:
        key - Key
        Returns:
        Data or null if not found or expired
      • remove

        public void remove​(java.lang.String key)
        Remove data from cache
        Parameters:
        key - Key
      • clear

        public void clear()
        Clear all data from cache
      • size

        public long size()
        Get data cache size