ReaderCache { public void clear() { if (fastCache != null) { cache.invalidateAll(); fastCache.clear(); } } protected  ReaderCache(long maxWeight, int averageWeight,
            @NotNull String name, @NotNull Weigher<CacheKey, T> weigher); @NotNull CacheStats getStats(); @NotNull T get(long msb, long lsb, int offset, Function<Integer, T> loader); void clear();  }
@Test public void clear() { final AtomicInteger counter = new AtomicInteger(); Function<Integer, String> uniqueLoader = new Function<Integer, String>() { @Override @Nullable public String apply(@Nullable Integer input) { return valueOf(counter.incrementAndGet()); } }; StringCache c = new StringCache(0); assertEquals("1", c.get(0, 0, 0, uniqueLoader)); assertEquals("1", c.get(0, 0, 0, uniqueLoader)); c.clear(); assertEquals("2", c.get(0, 0, 0, uniqueLoader)); assertEquals("2", c.get(0, 0, 0, uniqueLoader)); }