JCacheBasedSupplierMemoizer extends AbstractJCacheBasedMemoizer<KEY, OUTPUT> implements Supplier<OUTPUT> { @Override public OUTPUT get() { return invoke(keySupplier.get(), key -> supplier.get()); } JCacheBasedSupplierMemoizer(
            final Cache<KEY, OUTPUT> cache,
            final Supplier<KEY> keySupplier,
            final Supplier<OUTPUT> supplier); @Override OUTPUT get();  }
@Test public void shouldMemoizeSupplier() { final Supplier<String> supplier = () -> "test"; final Supplier<String> keySupplier = () -> "key"; try (final Cache<String, String> cache = JCacheMemoize.createCache(Supplier.class)) { final JCacheBasedSupplierMemoizer<String, String> loader = new JCacheBasedSupplierMemoizer<>(cache, keySupplier, supplier); Assert.assertEquals("Memoized value does not match expectation", "test", loader.get()); } }