public LocalAwareModuleVersionRepository cached(LocalAwareModuleVersionRepository input) { if ("false".equalsIgnoreCase(System.getProperty(TOGGLE_PROPERTY))) { return input; } DependencyMetadataCache dataCache = cachePerRepo.get(input.getId()); stats.reposWrapped++; if (dataCache == null) { LOG.debug("Creating new in-memory cache for repo '{}' [{}].", input.getName(), input.getId()); dataCache = new DependencyMetadataCache(stats); stats.cacheInstances++; cachePerRepo.put(input.getId(), dataCache); } else { LOG.debug("Reusing in-memory cache for repo '{}' [{}].", input.getName(), input.getId()); } return new CachedRepository(dataCache, input, stats); }