Class MessageCache

  • All Implemented Interfaces:
    Cache

    public class MessageCache
    extends java.lang.Object
    implements Cache
    • Constructor Detail

      • MessageCache

        public MessageCache()
      • MessageCache

        public MessageCache​(java.lang.String id)
    • Method Detail

      • getCachedTranslationMap

        public java.util.Map<java.lang.String,​MessageCacheItem> getCachedTranslationMap()
      • getHitMap

        public java.util.Map<java.lang.String,​java.lang.Integer> getHitMap()
      • getId

        public java.lang.String getId()
      • setId

        public void setId​(java.lang.String id)
      • get

        public CacheItem get​(java.lang.String cacheKey)
        Description copied from interface: Cache
        get a component's cached data by key
        Specified by:
        get in interface Cache
        Returns:
        CacheItem object instance that holds the cached data (messages and associated properties)
      • getRemovedKeyFromHitMap

        public java.lang.String getRemovedKeyFromHitMap()
      • put

        public boolean put​(java.lang.String cacheKey,
                           CacheItem itemToCache)
        Description copied from interface: Cache
        put strings to cache by key
        Specified by:
        put in interface Cache
        Parameters:
        cacheKey - cache key
        itemToCache - item to be stored in the cache
        Returns:
        false if failed to put
      • remove

        public boolean remove​(java.lang.String cacheKey)
        Description copied from interface: Cache
        remove a component from cache by key
        Specified by:
        remove in interface Cache
        Returns:
        false if failed to remove
      • clear

        public boolean clear()
        Description copied from interface: Cache
        clear all components in the cache
        Specified by:
        clear in interface Cache
        Returns:
        false if failed to clear
      • size

        public int size()
        Description copied from interface: Cache
        get count of current cached components
        Specified by:
        size in interface Cache
        Returns:
        count of cached components
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Description copied from interface: Cache
        get the set of cached keys
        Specified by:
        keySet in interface Cache
        Returns:
        set of cached keys
      • getExpiredTime

        public long getExpiredTime()
        Description copied from interface: Cache
        get expired time
        Specified by:
        getExpiredTime in interface Cache
        Returns:
        long time
      • setExpiredTime

        public void setExpiredTime​(long millis)
        Description copied from interface: Cache
        set expired time
        Specified by:
        setExpiredTime in interface Cache
      • getLastClean

        public long getLastClean()
        Description copied from interface: Cache
        get time of last clean
        Specified by:
        getLastClean in interface Cache
        Returns:
        long time
      • setLastClean

        public void setLastClean​(long millis)
        Description copied from interface: Cache
        set time of last clean
        Specified by:
        setLastClean in interface Cache
      • getCachedKeySize

        public int getCachedKeySize()
      • setCapacityByKey

        public void setCapacityByKey​(int capacityByKey)
      • getCapacityByKey

        public int getCapacityByKey()
      • setXCapacity

        public void setXCapacity​(int capacityX)
        Description copied from interface: Cache
        set the cache's capacity by specifying the count of components
        Specified by:
        setXCapacity in interface Cache
      • getXCapacity

        public int getXCapacity()
        Description copied from interface: Cache
        get the cache capacity
        Specified by:
        getXCapacity in interface Cache
        Returns:
        cache capacity
      • isFull

        public boolean isFull()
      • isExpired

        public boolean isExpired()
        Deprecated.
        Use the isExpired method.
        Specified by:
        isExpired in interface Cache
      • getDropId

        public java.lang.String getDropId()
        Description copied from interface: Cache
        get a id of translation drop
        Specified by:
        getDropId in interface Cache
        Returns:
        a drop id
      • setDropId

        public void setDropId​(java.lang.String dropId)