ComplexEvent generateEventWithRequiredFields(ComplexEvent event,
                                                 SiddhiAppContext siddhiAppContext,
                                                 boolean cacheExpiryEnabled) {
        if (event instanceof StreamEvent) {
            StreamEvent eventForCache = addRequiredFields(event, siddhiAppContext, cacheExpiryEnabled);
            return eventForCache;
        } else if (event instanceof StateEvent) {
            StreamEvent eventForCache = addRequiredFields(((StateEvent) event).getStreamEvent(0),
                    siddhiAppContext, cacheExpiryEnabled);
            StateEvent stateEvent = new StateEvent(((StateEvent) event).getStreamEvents().length,
                    eventForCache.getOutputData().length);
            stateEvent.addEvent(0, eventForCache);
            return stateEvent;
        } else {
            return null;
        }
    }
common interface for FIFO, LRU, and LFU cache tables
modules/siddhi-core/src/main/java/io/siddhi/core/table/CacheTable.java