public void addStreamEventUptoMaxSize(StreamEvent streamEvent) {
        int sizeAfterAdding = this.size();
        ComplexEventChunk<StreamEvent> addEventsLimitCopy = new ComplexEventChunk<>();
        while (sizeAfterAdding < maxSize && streamEvent != null) {
            sizeAfterAdding++;
            addEventsLimitCopy.add((StreamEvent) generateEventWithRequiredFields(streamEvent, siddhiAppContext,
                    cacheExpiryEnabled));
            streamEvent = streamEvent.getNext();
        }
        readWriteLock.writeLock().lock();
        try {
            this.add(addEventsLimitCopy);
        } finally {
            readWriteLock.writeLock().unlock();
        }
    }
common interface for FIFO, LRU, and LFU cache tables
modules/siddhi-core/src/main/java/io/siddhi/core/table/CacheTable.java