Interface HstCache


public interface HstCache
HST Cache Interface for cache related activities. Abstraction around physical cache implementation.
Version:
$Id$
  • Method Details

    • createElement

      CacheElement createElement(Object key, Object content)
    • createUncacheableElement

      CacheElement createUncacheableElement(Object key, Object content)
      Returns:
      a CacheElement that is marked to be uncacheable
    • put

      void put(CacheElement object)
    • get

      CacheElement get(Object key)
      Returns the CacheElement for key and null otherwise.
      Parameters:
      key -
      Returns:
      the CacheElement for key and null otherwise
    • get

      CacheElement get(Object key, Callable<? extends CacheElement> valueLoader) throws Exception
      Returns cached object associated with the key in the cache, obtaining that value from the valueLoader if necessary. It provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern. The entire method invocation is performed atomically and the function is called at most once per key. Concurrent requests with the same key are blocked until the value is obtained from the function.
      Parameters:
      key - the key to get from the cache or to put an object for in the cache when the cache does not yet contain key
      valueLoader - will be used to load the value for key if cache does not yet contain an object for key. The loaded value is put in the cache. The valueLoader is not allowed to return null but is allowed to return a CacheElement with content null.
      Returns:
      the element from the cache, or the just retrieved and stored element through valueloader
      Throws:
      Exception
    • isKeyInCache

      boolean isKeyInCache(Object key)
    • remove

      boolean remove(Object key)
    • clear

      void clear()
    • getTimeToIdleSeconds

      int getTimeToIdleSeconds()
    • getTimeToLiveSeconds

      int getTimeToLiveSeconds()
    • getSize

      int getSize()
    • getMaxSize

      int getMaxSize()