public synchronized void resize(final long newCacheSizeBytes) {
        final boolean shrink = newCacheSizeBytes < maxCacheSizeBytes;
        maxCacheSizeBytes = newCacheSizeBytes;
        if (shrink) {
            log.debug("Cache size was shrunk to {}", newCacheSizeBytes);
            if (caches.values().isEmpty()) {
                return;
            }
            final CircularIterator<NamedCache> circularIterator = new CircularIterator<>(caches.values());
            while (sizeInBytes.get() > maxCacheSizeBytes) {
                final NamedCache cache = circularIterator.next();
                synchronized (cache) {
                    final long oldSize = cache.sizeInBytes();
                    cache.evict();
                    sizeInBytes.getAndAdd(cache.sizeInBytes() - oldSize);
                }
                numEvicts++;
            }
        } else {
            log.debug("Cache size was expanded to {}", newCacheSizeBytes);
        }
    }
An in-memory LRU cache store similar to {@link MemoryLRUCache} but byte-based, not
record based
streams/src/main/java/org/apache/kafka/streams/state/internals/ThreadCache.java