Class HistoricalDataCacheLRUImpl
java.lang.Object
com.espertech.esper.common.internal.epl.historical.datacache.HistoricalDataCacheLRUImpl
- All Implemented Interfaces:
HistoricalDataCache
Query result data cache implementation that uses a least-recently-used algorithm
to store and evict query results.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Retrieves an entry from the cache.int
Returns the maximum cache size.boolean
isActive()
Returns true if the cache is active and currently caching, or false if the cache is inactive and not currently cachingvoid
put
(Object methodParams, EventTable[] rows) Adds an entry to this cache.
-
Constructor Details
-
HistoricalDataCacheLRUImpl
public HistoricalDataCacheLRUImpl(int cacheSize) Ctor.- Parameters:
cacheSize
- is the maximum cache size
-
-
Method Details
-
getCached
Retrieves an entry from the cache. The retrieved entry becomes the MRU (most recently used) entry.- Specified by:
getCached
in interfaceHistoricalDataCache
- 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
Adds an entry to this cache. If the cache is full, the LRU (least recently used) entry is dropped.- Specified by:
put
in interfaceHistoricalDataCache
- 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 interfaceHistoricalDataCache
- Returns:
- true for caching enabled, false for no caching taking place
-
destroy
public void destroy()- Specified by:
destroy
in interfaceHistoricalDataCache
-