public class DataCacheExpiringImpl extends Object implements DataCache, ScheduleHandleCallback
The cache reference type indicates which backing Map is used: Weak type uses the WeakHashMap, Soft type uses the apache commons ReferenceMap, and Hard type simply uses a HashMap.
Constructor and Description |
---|
DataCacheExpiringImpl(double maxAgeSec,
double purgeIntervalSec,
ConfigurationCacheReferenceType cacheReferenceType,
SchedulingService schedulingService,
long scheduleSlot,
EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
TimeAbacus timeAbacus)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
EventTable[] |
getCached(Object[] methodParams,
int numLookupKeys)
Ask the cache if the keyed value is cached, returning a list or rows if the key is in the cache,
or returning null to indicate no such key cached.
|
protected double |
getMaxAgeSec()
Returns the maximum age in milliseconds.
|
double |
getPurgeIntervalSec() |
protected long |
getSize()
Returns the current 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(Object[] methodParams,
int numLookupKeys,
EventTable[] rows)
Puts into the cache a key and a list of rows, or an empty list if zero rows.
|
void |
scheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
Callback that is invoked as indicated by a schedule added to the scheduling service.
|
public DataCacheExpiringImpl(double maxAgeSec, double purgeIntervalSec, ConfigurationCacheReferenceType cacheReferenceType, SchedulingService schedulingService, long scheduleSlot, EPStatementAgentInstanceHandle epStatementAgentInstanceHandle, TimeAbacus timeAbacus)
maxAgeSec
- is the maximum age in secondspurgeIntervalSec
- is the purge interval in secondscacheReferenceType
- indicates whether hard, soft or weak references are used in the cacheschedulingService
- is a service for call backs at a scheduled time, for purgingscheduleSlot
- slot for scheduling callbacks for this cacheepStatementAgentInstanceHandle
- is the statements-own handle for use in registering callbacks with servicestimeAbacus
- time abacuspublic EventTable[] getCached(Object[] methodParams, int numLookupKeys)
DataCache
getCached
in interface DataCache
methodParams
- is the keys to look up in the cachenumLookupKeys
- number of method param keys, from the start, that are for cache lookuppublic void put(Object[] methodParams, int numLookupKeys, EventTable[] rows)
DataCache
The put method is designed to be called when the cache does not contain a key as determined by the get method. Implementations typically simply overwrite any keys put into the cache that already existed in the cache.
protected double getMaxAgeSec()
public double getPurgeIntervalSec()
public boolean isActive()
DataCache
protected long getSize()
public void scheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
ScheduleHandleCallback
scheduledTrigger
in interface ScheduleHandleCallback
engineLevelExtensionServicesContext
- is a marker interface for providing custom extension services
passed to the triggered class