2 * This file is part of memoization.java. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of memoization.java,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
7 package de
.xn__ho_hia
.memoization
.jcache
;
9 import java
.util
.function
.LongSupplier
;
10 import java
.util
.function
.Supplier
;
12 import javax
.cache
.Cache
;
14 final class JCacheBasedLongSupplierMemoizer
<KEY
>
15 extends AbstractJCacheBasedMemoizer
<KEY
, Long
>
16 implements LongSupplier
{
18 private final Supplier
<KEY
> keySupplier
;
19 private final LongSupplier supplier
;
21 JCacheBasedLongSupplierMemoizer(
22 final Cache
<KEY
, Long
> cache
,
23 final Supplier
<KEY
> keySupplier
,
24 final LongSupplier supplier
) {
26 this.keySupplier
= keySupplier
;
27 this.supplier
= supplier
;
31 public long getAsLong() {
32 return invoke(keySupplier
.get(), key
-> Long
.valueOf(supplier
.getAsLong())).longValue();