Class MessageCache2

  • All Implemented Interfaces:
    Cache

    public class MessageCache2
    extends java.lang.Object
    implements Cache
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageCache2()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean clear()
      clear all components in the cache
      MessageCacheItem get​(java.lang.String cacheKey)
      get a component's cached data by key
      int getCacheKeySize()  
      java.lang.String getDropId()
      get a id of translation drop
      long getExpiredTime()
      get expired time
      long getLastClean()
      get time of last clean
      int getXCapacity()
      get the cache capacity
      int getYCapacity()  
      boolean isExpired()  
      boolean isExpired​(java.lang.String cacheKey)  
      boolean isFull()  
      java.util.Set<java.lang.String> keySet()
      get the set of cached keys
      boolean put​(java.lang.String cacheKey, CacheItem itemToCache)
      put strings to cache by key
      boolean remove​(java.lang.String cacheKey)
      remove a component from cache by key
      void setDropId​(java.lang.String dropId)  
      void setExpiredTime​(long millis)
      set expired time
      void setLastClean​(long millis)
      set time of last clean
      void setXCapacity​(int capacityX)
      set the cache's capacity by specifying the count of components
      void setYCapacity​(int capacityY)  
      int size()
      get count of current cached components
      int sizeOfComponent()  
      • Methods inherited from class java.lang.Object

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

      • MessageCache2

        public MessageCache2()
    • Method Detail

      • get

        public MessageCacheItem 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)
      • isExpired

        public boolean isExpired​(java.lang.String cacheKey)
      • 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
      • sizeOfComponent

        public int sizeOfComponent()
      • 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
      • getCacheKeySize

        public int getCacheKeySize()
      • 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
      • getYCapacity

        public int getYCapacity()
      • setYCapacity

        public void setYCapacity​(int capacityY)
      • isFull

        public boolean isFull()
      • isExpired

        public boolean isExpired()
        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)