@Override
    protected void connectAndLoadCache() throws ConnectionUnavailableException {
        connect();
        if (cacheEnabled) {
            ((CacheTable) cacheTable).deleteAll();
            StateEvent stateEventForCaching = new StateEvent(1, 0);
            StreamEvent preLoadedData;
            queryStoreWithoutCheckingCache.set(Boolean.TRUE);
            try {
                preLoadedData = query(stateEventForCaching, compiledConditionForCaching,
                        compiledSelectionForCaching, outputAttributesForCaching);
            } finally {
                queryStoreWithoutCheckingCache.set(Boolean.FALSE);
            }

            if (preLoadedData != null) {
                ((CacheTable) cacheTable).addStreamEventUptoMaxSize(preLoadedData);
            }
            if (cacheExpiryEnabled) {
                siddhiAppContext.getScheduledExecutorService().scheduleAtFixedRate(
                        new CacheExpirer(retentionPeriod, cacheTable, tableMap, this, siddhiAppContext).
                                generateCacheExpirer(), 0, purgeInterval, TimeUnit.MILLISECONDS);
            }
        }
    }
An abstract implementation of table. Abstract implementation will handle {@link ComplexEventChunk} so that
developer can directly work with event data.
modules/siddhi-core/src/main/java/io/siddhi/core/table/record/AbstractQueryableRecordTable.java