List of usage examples for com.google.common.cache CacheBuilder newBuilder
public static CacheBuilder<Object, Object> newBuilder()
From source file:com.sangupta.snowpack.SnowpackCache.java
/** * Constructor that creates a new caching instance for all chunk * readers./*from w w w . j ava 2s. c om*/ * * @param cachingEnabled */ public SnowpackCache(boolean cachingEnabled, final int maxEntriesInReadCache) { this.cachingEnabled = cachingEnabled; if (cachingEnabled) { GLOBAL_FLAKE_CACHE = CacheBuilder.newBuilder().maximumSize(maxEntriesInReadCache) // keep only last 10000 entries in cache .build(); } else { GLOBAL_FLAKE_CACHE = null; } }
From source file:org.eigenbase.rel.metadata.MetadataFactoryImpl.java
public MetadataFactoryImpl(RelMetadataProvider provider) { this.cache = CacheBuilder.newBuilder().build(loader(provider)); }
From source file:org.nmdp.gl.client.cache.CacheGlClientModule.java
@Provides @GlClientAlleleCache protected Cache<String, Allele> createAlleleCache() { return CacheBuilder.newBuilder().initialCapacity(10000).build(); }
From source file:com.stratio.cassandra.lucene.cache.SearchCache.java
/** * Constructor taking the base table metadata and the max number of cache entries. * * @param metadata the base table metadata * @param cacheSize the max number of cache entries *//*from ww w .j a v a 2s. c o m*/ public SearchCache(CFMetaData metadata, int cacheSize) { this.comparator = metadata.comparator; this.cache = CacheBuilder.newBuilder().maximumSize(cacheSize).build(); }
From source file:net.identio.server.service.transaction.TransactionService.java
public TransactionService() { transactionCache = CacheBuilder.newBuilder().maximumSize(100000).expireAfterAccess(10, TimeUnit.MINUTES) .build(new CacheLoader<String, TransactionData>() { public TransactionData load(@Nonnull String o) { return new TransactionData(); }/*from w ww. j a v a 2 s . c o m*/ }); }
From source file:org.codelibs.fess.helper.PopularWordHelper.java
@PostConstruct public void init() { fessConfig = ComponentUtil.getFessConfig(); cache = CacheBuilder.newBuilder() .maximumSize(fessConfig.getSuggestPopularWordCacheSizeAsInteger().longValue()) .expireAfterWrite(fessConfig.getSuggestPopularWordCacheExpireAsInteger().longValue(), TimeUnit.MINUTES) .build();//from w w w .java 2 s .c om }
From source file:com.jillesvangurp.xmltools.XPathExpressionCache.java
public XPathExpressionCache(int cacheSize, int evictionOfUnusedInMinutes) { cache = CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(cacheSize) .expireAfterAccess(evictionOfUnusedInMinutes, TimeUnit.MINUTES).build(); final XPathFactory xpf = XPathFactory.newInstance(); xpath = xpf.newXPath();/*from w w w . jav a 2s . com*/ xpath.setNamespaceContext(new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { // hack to keep xpath happy return "http://domain.com/" + prefix; } @Override @SuppressWarnings("rawtypes") public Iterator getPrefixes(String val) { // Dummy implementation - not used! return null; } @Override public String getPrefix(String uri) { // Dummy implementation - not used! return null; } }); }
From source file:fr.xebia.cocktail.CocktailRepository.java
public CocktailRepository() { cocktails = CacheBuilder.newBuilder().maximumSize(100).build(); insert(buildLongIslandCocktail()); insert(buildSexOnTheBeachCocktail()); }
From source file:hudson.model.TopLevelItemsCache.java
TopLevelItemsCache() { cache = CacheBuilder.newBuilder().initialCapacity(INITIAL_CAPACITY) .expireAfterAccess(EVICT_IN_SECONDS, TimeUnit.SECONDS).maximumSize(MAX_ENTRIES).softValues() .removalListener(new RemovalListener<LazyTopLevelItem.Key, TopLevelItem>() { @Override/*w ww. j a va2 s . co m*/ public void onRemoval(RemovalNotification<LazyTopLevelItem.Key, TopLevelItem> notification) { // System.out.println("*** Removed from cache " + notification.getKey().name ); } }).build(new CacheLoader<LazyTopLevelItem.Key, TopLevelItem>() { Map<String, Integer> map = new HashMap<String, Integer>(); @Override public TopLevelItem load(LazyTopLevelItem.Key key) throws Exception { TopLevelItem item = (TopLevelItem) key.configFile.read(); item.onLoad(key.parent, key.name); return item; } }); }
From source file:org.apache.jackrabbit.oak.spi.blob.split.BlobIdSet.java
BlobIdSet(String repositoryDir, String filename) { store = new File(new File(repositoryDir), filename); bloomFilter = BloomFilter.create(Funnels.stringFunnel(Charsets.UTF_8), 9000000); // about 8MB cache = CacheBuilder.newBuilder().maximumSize(1000).build(); fillBloomFilter();/* w w w . j a va 2 s . c om*/ }