Java源码示例:com.github.benmanes.caffeine.cache.Expiry
示例1
public Expiry<Integer, Integer> expiry() {
return expiry;
}
示例2
public <K, V> Expiry<K, V> build() {
return new FixedExpiry<K, V>(createNanos, updateNanos, readNanos);
}
示例3
/**
* Returns the {@link Factory} for the {@link Expiry} to be used for the cache.
*
* @return the {@link Factory} for the {@link Expiry}
*/
public Optional<Factory<Expiry<K, V>>> getExpiryFactory() {
return Optional.ofNullable(expiryFactory);
}
示例4
/**
* Set the {@link Factory} for the {@link Expiry}.
*
* @param factory the {@link Expiry} {@link Factory}
*/
@SuppressWarnings("unchecked")
public void setExpiryFactory(Optional<Factory<? extends Expiry<K, V>>> factory) {
expiryFactory = (Factory<Expiry<K, V>>) factory.orElse(null);
}