Class EHCacheImpl<T>

java.lang.Object
org.serviceconnector.cache.ehcache.EHCacheImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
ISCCacheModule<T>

public class EHCacheImpl<T> extends Object implements ISCCacheModule<T>
The Class EHCacheSCMPCacheImpl. This class wraps the EHCache implementation of a cache.
  • Method Details

    • get

      public T get(Object key)
      Gets the object from cache module.
      Specified by:
      get in interface ISCCacheModule<T>
      Parameters:
      key - the key
      Returns:
      the object
    • putOrUpdate

      public void putOrUpdate(Object key, T value, int timeToLiveSeconds)
      Put the object in cache module. Existing elements are replaced.
      Specified by:
      putOrUpdate in interface ISCCacheModule<T>
      Parameters:
      key - the key
      value - the value to store
      timeToLiveSeconds - seconds the object has to stay in cache module from now on
    • replace

      public void replace(Object key, T value, int timeToLiveSeconds)
      Description copied from interface: ISCCacheModule
      Replace the object in cache module. Element has to be in place otherwise replace fails.
      Specified by:
      replace in interface ISCCacheModule<T>
      Parameters:
      key - the key
      value - the value to store
      timeToLiveSeconds - seconds the object has to stay in cache module from now on
    • getExpirationTime

      public Date getExpirationTime(String key)
      Description copied from interface: ISCCacheModule
      Gets the expiration time.
      Specified by:
      getExpirationTime in interface ISCCacheModule<T>
      Parameters:
      key - the key
      Returns:
      the expiration time
    • getCreationTime

      public Date getCreationTime(String key)
      Description copied from interface: ISCCacheModule
      Gets the creation time.
      Specified by:
      getCreationTime in interface ISCCacheModule<T>
      Parameters:
      key - the key
      Returns:
      the creation time
    • getLastAccessTime

      public Date getLastAccessTime(String key)
      Description copied from interface: ISCCacheModule
      Gets the last access time.
      Specified by:
      getLastAccessTime in interface ISCCacheModule<T>
      Parameters:
      key - the key
      Returns:
      the last access time
    • getKeyList

      public List<String> getKeyList()
      Description copied from interface: ISCCacheModule
      Gets the list of keys in the cache module.
      Specified by:
      getKeyList in interface ISCCacheModule<T>
      Returns:
      the keys with expire check
    • getCacheModuleName

      public String getCacheModuleName()
      Gets the cache name.
      Specified by:
      getCacheModuleName in interface ISCCacheModule<T>
      Returns:
      the cache name
    • getNumberOfMessagesInStore

      public long getNumberOfMessagesInStore()
      Gets the memory store size.
      Specified by:
      getNumberOfMessagesInStore in interface ISCCacheModule<T>
      Returns:
      the memory store size
    • getNumberOfMessagesInDiskStore

      public long getNumberOfMessagesInDiskStore()
      Gets the disk store size.
      Specified by:
      getNumberOfMessagesInDiskStore in interface ISCCacheModule<T>
      Returns:
      the disk store size
    • getOffHeapSize

      public long getOffHeapSize()
      Description copied from interface: ISCCacheModule
      Gets the off heap size.
      Specified by:
      getOffHeapSize in interface ISCCacheModule<T>
      Returns:
      the off heap size
    • getInMemorySize

      public long getInMemorySize()
      Description copied from interface: ISCCacheModule
      Gets the in memory size.
      Specified by:
      getInMemorySize in interface ISCCacheModule<T>
      Returns:
      the in memory size
    • remove

      public T remove(Object key)
      Removes the object from cache module.
      Specified by:
      remove in interface ISCCacheModule<T>
      Parameters:
      key - the key
      Returns:
      true, if successful
    • removeAll

      public void removeAll()
      Removes all the objects from cache module.
      Specified by:
      removeAll in interface ISCCacheModule<T>
    • destroy

      public void destroy()
      Destroys the cache module.
      Specified by:
      destroy in interface ISCCacheModule<T>