ExpiringCache implements WriteCache { @Override public boolean checkCacheOrSet(final Metric metric) { return check(metric); } ExpiringCache(final Cache<String, Boolean> writeCache); @Override boolean checkCacheOrSet(final Metric metric); @Override boolean checkCacheOrSet(final com.spotify.ffwd.model.v2.Metric metric);  }
@Test public void testIsCached() { final Cache<String, Boolean> cache = CacheBuilder.newBuilder().expireAfterWrite(Duration.ofMinutes(1)).build(); final WriteCache expiringCache = new ExpiringCache(cache); assertFalse(expiringCache.checkCacheOrSet(Utils.makeMetric())); assertTrue(expiringCache.checkCacheOrSet(Utils.makeMetric())); }