public LRUCacheEntry delete(final String namespace, final Bytes key) {
        final NamedCache cache = getCache(namespace);
        if (cache == null) {
            return null;
        }

        final LRUCacheEntry entry;
        synchronized (cache) {
            final long oldSize = cache.sizeInBytes();
            entry = cache.delete(key);
            sizeInBytes.getAndAdd(cache.sizeInBytes() - oldSize);
        }
        return entry;
    }
Add a listener that is called each time an entry is evicted from the cache or an explicit flush is called
streams/src/main/java/org/apache/kafka/streams/state/internals/ThreadCache.java