com.espertech.esper.epl.db
Class DataCacheLRUImpl

java.lang.Object
  extended by com.espertech.esper.epl.db.DataCacheLRUImpl
All Implemented Interfaces:
DataCache

public class DataCacheLRUImpl
extends java.lang.Object
implements DataCache

Query result data cache implementation that uses a least-recently-used algorithm to store and evict query results.


Constructor Summary
DataCacheLRUImpl(int cacheSize)
          Ctor.
 
Method Summary
 EventTable[] getCached(java.lang.Object[] lookupKeys)
          Retrieves an entry from the cache.
 int getCacheSize()
          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 caching
 void put(java.lang.Object[] keys, EventTable[] value)
          Adds an entry to this cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataCacheLRUImpl

public DataCacheLRUImpl(int cacheSize)
Ctor.

Parameters:
cacheSize - is the maximum cache size
Method Detail

getCached

public EventTable[] getCached(java.lang.Object[] lookupKeys)
Retrieves an entry from the cache. The retrieved entry becomes the MRU (most recently used) entry.

Specified by:
getCached in interface DataCache
Parameters:
lookupKeys - 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(java.lang.Object[] keys,
                EventTable[] value)
Adds an entry to this cache. If the cache is full, the LRU (least recently used) entry is dropped.

Specified by:
put in interface DataCache
Parameters:
keys - the keys with which the specified value is to be associated.
value - 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: DataCache
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 DataCache
Returns:
true for caching enabled, false for no caching taking place

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com