public void put(Object[] lookupKeys, EventTable rows) { Object key = DataCacheUtil.getLookupKey(lookupKeys); long now = schedulingService.getTime(); Item item = new Item(rows, now); cache.put(key, item); if (!isScheduled) { EPStatementHandleCallback callback = new EPStatementHandleCallback(epStatementAgentInstanceHandle, this); schedulingService.add(purgeIntervalMSec, callback, scheduleSlot); isScheduled = true; } }
public EventTable getCached(Object[] lookupKeys) { Object key = DataCacheUtil.getLookupKey(lookupKeys); Item item = cache.get(key); if (item == null) { return null; } long now = schedulingService.getTime(); if ((now - item.getTime()) > maxAgeMSec) { cache.remove(key); return null; } return item.getData(); }