com.github.benmanes.caffeine.cache.Caffeine.refreshes()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(254)

本文整理了Java中com.github.benmanes.caffeine.cache.Caffeine.refreshes()方法的一些代码示例,展示了Caffeine.refreshes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caffeine.refreshes()方法的具体详情如下:
包路径:com.github.benmanes.caffeine.cache.Caffeine
类名称:Caffeine
方法名:refreshes

Caffeine.refreshes介绍

暂无

代码示例

代码示例来源:origin: ben-manes/caffeine

long getRefreshAfterWriteNanos() {
 return refreshes() ? refreshNanos : DEFAULT_REFRESH_NANOS;
}

代码示例来源:origin: ben-manes/caffeine

@NonNull
Ticker getTicker() {
 boolean useTicker = expiresVariable() || expiresAfterAccess()
   || expiresAfterWrite() || refreshes() || isRecordingStats();
 return useTicker
   ? (ticker == null) ? Ticker.systemTicker() : ticker
   : Ticker.disabledTicker();
}

代码示例来源:origin: ben-manes/caffeine

return isBounded() || refreshes()
  ? new BoundedLocalCache.BoundedLocalAsyncLoadingCache<>(self, loader)
  : new UnboundedLocalCache.UnboundedLocalAsyncLoadingCache<>(self, loader);

代码示例来源:origin: ben-manes/caffeine

/**
 * Builds a cache, which either returns an already-loaded value for a given key or atomically
 * computes or retrieves it using the supplied {@code CacheLoader}. If another thread is currently
 * loading the value for this key, simply waits for that thread to finish and returns its loaded
 * value. Note that multiple threads can concurrently load values for distinct keys.
 * <p>
 * This method does not alter the state of this {@code Caffeine} instance, so it can be invoked
 * again to create multiple independent caches.
 *
 * @param loader the cache loader used to obtain new values
 * @param <K1> the key type of the loader
 * @param <V1> the value type of the loader
 * @return a cache having the requested features
 */
@NonNull
public <K1 extends K, V1 extends V> LoadingCache<K1, V1> build(
  @NonNull CacheLoader<? super K1, V1> loader) {
 requireWeightWithWeigher();
 @SuppressWarnings("unchecked")
 Caffeine<K1, V1> self = (Caffeine<K1, V1>) this;
 return isBounded() || refreshes()
   ? new BoundedLocalCache.BoundedLocalLoadingCache<>(self, loader)
   : new UnboundedLocalCache.UnboundedLocalLoadingCache<>(self, loader);
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

@Nonnegative
long getRefreshAfterWriteNanos() {
 return refreshes() ? refreshNanos : DEFAULT_REFRESH_NANOS;
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

if (builder.refreshes()) {
  sb.append('A');
  if (builder.evicts()) {
if (builder.refreshes()) {
 sb.append('R');

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

/**
 * Builds a cache, which either returns an already-loaded value for a given key or atomically
 * computes or retrieves it using the supplied {@code CacheLoader}. If another thread is currently
 * loading the value for this key, simply waits for that thread to finish and returns its loaded
 * value. Note that multiple threads can concurrently load values for distinct keys.
 * <p>
 * This method does not alter the state of this {@code Caffeine} instance, so it can be invoked
 * again to create multiple independent caches.
 *
 * @param loader the cache loader used to obtain new values
 * @param <K1> the key type of the loader
 * @param <V1> the value type of the loader
 * @return a cache having the requested features
 */
@Nonnull
public <K1 extends K, V1 extends V> LoadingCache<K1, V1> build(
  @Nonnull CacheLoader<? super K1, V1> loader) {
 requireWeightWithWeigher();
 @SuppressWarnings("unchecked")
 Caffeine<K1, V1> self = (Caffeine<K1, V1>) this;
 return isBounded() || refreshes()
   ? new BoundedLocalCache.BoundedLocalLoadingCache<>(self, loader)
   : new UnboundedLocalCache.UnboundedLocalLoadingCache<>(self, loader);
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

@Nonnull
Ticker getTicker() {
 boolean useTicker = expiresVariable() || expiresAfterAccess()
   || expiresAfterWrite() || refreshes() || isRecordingStats();
 return useTicker
   ? (ticker == null) ? Ticker.systemTicker() : ticker
   : Ticker.disabledTicker();
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

/**
 * Builds a cache which does not automatically load values when keys are requested.
 * <p>
 * Consider {@link #build(CacheLoader)} instead, if it is feasible to implement a
 * {@code CacheLoader}.
 * <p>
 * This method does not alter the state of this {@code Caffeine} instance, so it can be invoked
 * again to create multiple independent caches.
 *
 * @param <K1> the key type of the cache
 * @param <V1> the value type of the cache
 * @return a cache having the requested features
 */
@Nonnull
public <K1 extends K, V1 extends V> Cache<K1, V1> build() {
 requireWeightWithWeigher();
 requireNonLoadingCache();
 @SuppressWarnings("unchecked")
 Caffeine<K1, V1> self = (Caffeine<K1, V1>) this;
 return isBounded() || refreshes()
   ? new BoundedLocalCache.BoundedLocalManualCache<>(self)
   : new UnboundedLocalCache.UnboundedLocalManualCache<>(self);
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

return isBounded() || refreshes()
  ? new BoundedLocalCache.BoundedLocalAsyncLoadingCache<>(self, loader)
  : new UnboundedLocalCache.UnboundedLocalAsyncLoadingCache<>(self, loader);

相关文章