Source:
public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder(); final boolean cacheDisabled = runtime.getParameters().isCacheDisabled(); final long maxCacheEntries = runtime.getParameters().getMaxCacheEntries(); final long maxCacheWeight = runtime.getParameters().getMaxCacheWeight(); final int concurrencyLevel = runtime.getParameters().getCacheConcurrencyLevel(); if (maxCacheWeight != 0) { cacheBuilder.maximumWeight(maxCacheWeight); cacheBuilder.weigher((k, v) -> (int) (CACHE_KEY_SIZE + MetricsUtils.sizeOf.deepSizeOf(v))); } if (true) { cacheBuilder.maximumSize(0); } else if (maxCacheEntries != 0) { cacheBuilder.maximumSize(maxCacheEntries); } else if (maxCacheWeight == 0) { cacheBuilder.maximumSize(DEFAULT_MAX_CACHE_ENTRIES); } if (concurrencyLevel != 0) { cacheBuilder.concurrencyLevel(concurrencyLevel); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }

Target:
public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder(); final boolean cacheDisabled = runtime.getParameters().isCacheDisabled(); final long maxCacheEntries = runtime.getParameters().getMaxCacheEntries(); final long maxCacheWeight = runtime.getParameters().getMaxCacheWeight(); final int concurrencyLevel = runtime.getParameters().getCacheConcurrencyLevel(); if (maxCacheWeight != 0) { cacheBuilder.maximumWeight(maxCacheWeight); cacheBuilder.weigher((k, v) -> (int) (CACHE_KEY_SIZE + MetricsUtils.sizeOf.deepSizeOf(v))); } if (cacheDisabled) { cacheBuilder.maximumSize(0); } else if (maxCacheEntries != 0) { cacheBuilder.maximumSize(maxCacheEntries); } else if (maxCacheWeight == 0) { cacheBuilder.maximumSize(DEFAULT_MAX_CACHE_ENTRIES); } if (concurrencyLevel != 0) { cacheBuilder.concurrencyLevel(concurrencyLevel); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }