Example usage for com.google.common.cache CacheBuilder newBuilder

List of usage examples for com.google.common.cache CacheBuilder newBuilder

Introduction

In this page you can find the example usage for com.google.common.cache CacheBuilder newBuilder.

Prototype

public static CacheBuilder<Object, Object> newBuilder() 

Source Link

Document

Constructs a new CacheBuilder instance with default settings, including strong keys, strong values, and no automatic eviction of any kind.

Usage

From source file:org.polarsys.reqcycle.traceability.storage.sesame.storage.SesameRepositoryHolder.java

public SesameRepositoryHolder() {
    repositories = CacheBuilder.newBuilder().build(new InitRepositoryCallable());
    connections = CacheBuilder.newBuilder().build(new ThreadLocalConnectionsBuilderCallable());
}

From source file:app.service.FetchService.java

@Autowired
public FetchService(CollectionService colService) {
    mColService = colService;/*w w  w  .  j a va  2 s.  c  o  m*/

    mUrlInfoCache = CacheBuilder.newBuilder().initialCapacity(100).maximumSize(500)
            .expireAfterWrite(2, TimeUnit.HOURS).build();
}

From source file:com.sk89q.worldguard.bukkit.listener.debounce.legacy.AbstractEventDebounce.java

AbstractEventDebounce(int debounceTime) {
    cache = CacheBuilder.newBuilder().maximumSize(1000).expireAfterWrite(debounceTime, TimeUnit.MILLISECONDS)
            .concurrencyLevel(2).build(new CacheLoader<K, Entry>() {
                @Override/*  ww  w.ja  v  a 2 s. c om*/
                public Entry load(K key) throws Exception {
                    return new Entry();
                }
            });
}

From source file:ratpack.session.store.internal.DefaultSessionStore.java

public DefaultSessionStore(int maxEntries, int ttlMinutes) {
    storage = CacheBuilder.newBuilder().maximumSize(maxEntries).expireAfterAccess(ttlMinutes, TimeUnit.MINUTES)
            .build();//from w  w w .  j a  v  a2 s .  com
}

From source file:se252.jan15.calvinandhobbes.project0.IIScCampusMapGETProxyService.java

public static void cacheInit() {
    categoryCache = CacheBuilder.newBuilder().maximumSize(7) // maximum 7 records can be cached
            .expireAfterAccess(10, TimeUnit.MINUTES) // cache will expire after 10 minutes of access
            .build(new CacheLoader<String, String>() { // build the cacheloader
                @Override//  ww w . j  a  v  a2s  . c om
                public String load(String category) throws Exception {
                    return getCategoryData(category);
                }
            });
}

From source file:com.facebook.buck.rules.query.QueryCache.java

public QueryCache() {
    evaluators = CacheBuilder.newBuilder().build(CacheLoader.from(CachingQueryEvaluator::new));
}

From source file:com.atypon.wayf.cache.impl.LoadingCacheGuavaImpl.java

public LoadingCacheGuavaImpl() {
    guavaCache = CacheBuilder.newBuilder().build();
}

From source file:alluxio.master.file.meta.UfsSyncPathCache.java

/**
 * Creates a new instance of {@link UfsSyncPathCache}.
 */
public UfsSyncPathCache() {
    mCache = CacheBuilder.newBuilder().maximumSize(MAX_PATHS).build();
}

From source file:nu.yona.server.DOSProtectionService.java

@PostConstruct
private void initializeCache() {
    attemptsCache = CacheBuilder.newBuilder()
            .expireAfterWrite(yonaProperties.getSecurity().getDosProtectionWindow().getSeconds(),
                    TimeUnit.SECONDS)
            .build(new CacheLoader<String, Integer>() {
                @Override/*ww  w. j  a v  a 2  s.  co  m*/
                public Integer load(String key) {
                    return 0;
                }
            });
}

From source file:org.jlgranda.fede.cache.SubjectCacheProvider.java

public SubjectCacheProvider() {

    subjectCache = CacheBuilder.newBuilder().maximumSize(100).expireAfterWrite(5, TimeUnit.MINUTES)
            .build(new CacheLoader<Long, Subject>() {
                @Override/* w  ww .  ja v a 2  s .  co m*/
                public Subject load(Long id) throws Exception {
                    return subjectService.find(id);
                }
            });
}