com.github.benmanes.caffeine.cache.Expiry Java Examples

The following examples show how to use com.github.benmanes.caffeine.cache.Expiry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheContext.java    From caffeine with Apache License 2.0 4 votes vote down vote up
public Expiry<Integer, Integer> expiry() {
  return expiry;
}
 
Example #2
Source File: ExpiryBuilder.java    From caffeine with Apache License 2.0 4 votes vote down vote up
public <K, V> Expiry<K, V> build() {
  return new FixedExpiry<K, V>(createNanos, updateNanos, readNanos);
}
 
Example #3
Source File: CaffeineConfiguration.java    From caffeine with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: CaffeineConfiguration.java    From caffeine with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}