net.esper.eql.db
Class DataCacheLRUImpl

java.lang.Object
  extended by net.esper.eql.db.DataCacheLRUImpl
All Implemented Interfaces:
DataCache

public class DataCacheLRUImpl
extends 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
 List<EventBean> getCached(Object[] lookupKeys)
          Retrieves an entry from the cache.
 int getCacheSize()
          Returns the maximum cache size.
 void put(Object[] key, List<EventBean> 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 List<EventBean> getCached(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(Object[] key,
                List<EventBean> 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:
key - the key 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