Class HistoricalDataCacheLRUImpl

java.lang.Object
com.espertech.esper.common.internal.epl.historical.datacache.HistoricalDataCacheLRUImpl
All Implemented Interfaces:
HistoricalDataCache

public class HistoricalDataCacheLRUImpl extends Object implements HistoricalDataCache
Query result data cache implementation that uses a least-recently-used algorithm to store and evict query results.
  • Constructor Details

    • HistoricalDataCacheLRUImpl

      public HistoricalDataCacheLRUImpl(int cacheSize)
      Ctor.
      Parameters:
      cacheSize - is the maximum cache size
  • Method Details

    • getCached

      public EventTable[] getCached(Object methodParams)
      Retrieves an entry from the cache. The retrieved entry becomes the MRU (most recently used) entry.
      Specified by:
      getCached in interface HistoricalDataCache
      Parameters:
      methodParams - the key whose associated value is to be returned.
      Returns:
      the value associated to this key, or null if no value with this key exists in the cache.
    • put

      public void put(Object methodParams, EventTable[] rows)
      Adds an entry to this cache. If the cache is full, the LRU (least recently used) entry is dropped.
      Specified by:
      put in interface HistoricalDataCache
      Parameters:
      methodParams - the keys with which the specified value is to be associated.
      rows - a value to be associated with the specified key.
    • getCacheSize

      public int getCacheSize()
      Returns the maximum cache size.
      Returns:
      maximum cache size
    • isActive

      public boolean isActive()
      Description copied from interface: HistoricalDataCache
      Returns true if the cache is active and currently caching, or false if the cache is inactive and not currently caching
      Specified by:
      isActive in interface HistoricalDataCache
      Returns:
      true for caching enabled, false for no caching taking place
    • destroy

      public void destroy()
      Specified by:
      destroy in interface HistoricalDataCache