List of usage examples for com.google.common.cache CacheBuilder newBuilder
public static CacheBuilder<Object, Object> newBuilder()
From source file:org.gradle.initialization.DefaultClassLoaderScopeRegistry.java
public DefaultClassLoaderScopeRegistry(ClassLoaderRegistry loaderRegistry) { ClassLoaderCache cache = new DefaultClassLoaderCache( CacheBuilder.newBuilder().<DefaultClassLoaderCache.Key, ClassLoader>build()); this.coreScope = new RootClassLoaderScope(loaderRegistry.getGradleCoreApiClassLoader(), cache); this.coreAndPluginsScope = new RootClassLoaderScope(loaderRegistry.getGradleApiClassLoader(), cache); }
From source file:com.adr.data.cache.CacheProviderMem.java
public CacheProviderMem() { cache = CacheBuilder.newBuilder().maximumSize(1000).build(); }
From source file:com.torodb.torod.core.subdocument.BufferedSubDocTypeBuilderProvider.java
public BufferedSubDocTypeBuilderProvider() { subDocTypeCache = CacheBuilder.newBuilder().initialCapacity(1019) //a prime number .concurrencyLevel(8).build(new MyCacheLoader()); }
From source file:com.facebook.buck.apple.xcode.xcodeproj.PBXVariantGroup.java
public PBXVariantGroup(String name, @Nullable String path, SourceTree sourceTree) { super(name, path, sourceTree); variantFileReferencesByNameAndSourceTreePath = CacheBuilder.newBuilder() .build(new CacheLoader<VirtualNameAndSourceTreePath, PBXFileReference>() { @Override/*from www .j ava 2s.co m*/ public PBXFileReference load(VirtualNameAndSourceTreePath key) throws Exception { PBXFileReference ref = new PBXFileReference(key.getVirtualName(), key.getSourceTreePath().getPath().toString(), key.getSourceTreePath().getSourceTree()); getChildren().add(ref); return ref; } }); }
From source file:org.axonframework.ext.cache.GuavaCache.java
/** * c-tor//from ww w . j a v a 2s. co m * * @param cacheName the cache name */ public GuavaCache(String cacheName) { m_cacheName = cacheName; m_cache = CacheBuilder.newBuilder() //.removalListener(this) .build(); }
From source file:com.sam.moca.server.session.InMemoryMocaSessionManager.java
public InMemoryMocaSessionManager(String myDomain, String[] trustedDomains, int sessionTimeoutSecs, int remoteWindowSecs, boolean allowLegacySessions) { super(myDomain, trustedDomains, remoteWindowSecs, allowLegacySessions); _cache = CacheBuilder.newBuilder().expireAfterAccess(sessionTimeoutSecs, TimeUnit.SECONDS) .<String, Boolean>build(); }
From source file:org.apache.nutch.webui.client.NutchClientFactory.java
public NutchClientFactory() { cache = CacheBuilder.newBuilder().build(new NutchClientCacheLoader()); }
From source file:de.bund.bfr.math.Evaluator.java
private static <K> Cache<K, double[]> createCache() { return CacheBuilder.newBuilder().weigher((K key, double[] value) -> value.length).maximumWeight(1000000) .expireAfterAccess(1, TimeUnit.MINUTES).build(); }
From source file:com.facebook.buck.core.model.actiongraph.computation.ActionGraphCache.java
public ActionGraphCache(int maxEntries) { previousActionGraphs = CacheBuilder.newBuilder().maximumSize(maxEntries).build(); incrementalActionGraphGenerator = new IncrementalActionGraphGenerator(); }
From source file:org.javabits.yar.guice.CacheContainer.java
private static <V> CacheContainer<V> newConcurrentContainer(final Collection<KeyListener<Type>> typeListeners) { return new CacheContainer<>(CacheBuilder.newBuilder().build(new CacheLoader<Type, List<V>>() { @Override//ww w .jav a 2 s . c o m public List<V> load(Type key) { for (KeyListener<Type> typeListener : typeListeners) { typeListener.keyAdded(newKeyEvent(key)); } return new CopyOnWriteArrayList<>(); } }), typeListeners); }