/** * Clear all the bitmaps from the memory cache. */ public void evictAll() { cache.clear(); }
/** Stops this instance from accepting further requests. */ public void shutdown() { if (shutdown) { return; } cache.clear(); stats.shutdown(); dispatcher.shutdown(); if (closeableCache != null) { try { closeableCache.close(); } catch (IOException ignored) { } } for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; }
@Test public void evictAll() { PlatformLruCache cache = new PlatformLruCache(4); cache.set("a", A); cache.set("b", B); cache.set("c", C); cache.clear(); assertThat(cache.cache.snapshot()).isEmpty(); }