[ISSUE #7837] add expire checking for AutoExpireCache in common util. (#7392)

This commit is contained in:
Karson 2022-01-14 15:52:16 +08:00 committed by GitHub
parent 6f5b03d73e
commit cb6526c845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,10 +55,18 @@ public class AutoExpireCache<K, V> implements Cache<K, V> {
}
return this.delegate.get(key);
}
@Override
public V get(K key, Callable<? extends V> call) throws Exception {
return this.delegate.get(key, call);
V cachedValue = this.get(key);
if (null == cachedValue) {
V v2 = call.call();
this.put(key, v2);
return v2;
}
return cachedValue;
}
@Override