List of usage examples for com.google.common.collect MapMaker initialCapacity
int initialCapacity
To view the source code for com.google.common.collect MapMaker initialCapacity.
Click Source Link
From source file:com.navercorp.pinpoint.profiler.util.Maps.java
public static <K, V> ConcurrentMap<K, V> newWeakConcurrentMap(int initialCapacity) { final MapMaker weakMapMaker = createWeakMapMaker(); weakMapMaker.initialCapacity(initialCapacity); return weakMapMaker.makeMap(); }
From source file:org.ttrssreader.utils.AbstractCache.java
/** * Creates a new cache instance.//from w w w . j a v a2 s .c om * * @param initialCapacity the initial element size of the cache * @param maxConcurrentThreads how many threads you think may at once access the cache; this need not be an exact * number, but it helps in fragmenting the cache properly */ public AbstractCache(int initialCapacity, int maxConcurrentThreads) { MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); // mapMaker.expiration(expirationInMinutes * 60, TimeUnit.SECONDS); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues(); this.cache = mapMaker.makeMap(); }
From source file:com.wareninja.opensource.droidfu.cachefu.AbstractCache.java
/** * Creates a new cache instance./* w w w. j av a 2 s. c o m*/ * * @param name * a human readable identifier for this cache. Note that this value will be used to * derive a directory name if the disk cache is enabled, so don't get too creative * here (camel case names work great) * @param initialCapacity * the initial element size of the cache * @param expirationInMinutes * time in minutes after which elements will be purged from the cache (NOTE: this * only affects the memory cache, the disk cache does currently NOT handle element * TTLs!) * @param maxConcurrentThreads * how many threads you think may at once access the cache; this need not be an exact * number, but it helps in fragmenting the cache properly */ public AbstractCache(String name, int initialCapacity, long expirationInMinutes, int maxConcurrentThreads) { this.name = name; MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.expiration(expirationInMinutes * 60, TimeUnit.SECONDS); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues(); this.cache = mapMaker.makeMap(); }
From source file:quickutils.core.image.cache.AbstractCache.java
/** * Creates a new cache instance.// ww w .j a v a 2 s. c om * * @param name * a human readable identifier for this cache. Note that this value will be used to * derive a directory name if the disk cache is enabled, so don't get too creative * here (camel case names work great) * @param initialCapacity * the initial element size of the cache * @param expirationInMinutes * time in minutes after which elements will be purged from the cache * @param maxConcurrentThreads * how many threads you think may at once access the cache; this need not be an exact * number, but it helps in fragmenting the cache properly */ public AbstractCache(String name, int initialCapacity, long expirationInMinutes, int maxConcurrentThreads) { this.name = name; this.expirationInMinutes = expirationInMinutes; MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.expiration(expirationInMinutes * 60, TimeUnit.SECONDS); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues(); this.cache = mapMaker.makeMap(); }
From source file:com.tomdignan.remoteimage.AbstractCache.java
/** * Creates a new cache instance./*from www .j a v a2 s.c om*/ * * @param name * a human readable identifier for this cache. Note that this value will be used to * derive a directory name if the disk cache is enabled, so don't get too creative * here (camel case names work great) * @param initialCapacity * the initial element size of the cache * @param maxConcurrentThreads * how many threads you think may at once access the cache; this need not be an exact * number, but it helps in fragmenting the cache properly */ public AbstractCache(String name, int initialCapacity, long expirationInMinutes, int maxConcurrentThreads) { this.name = name; this.expirationInMinutes = expirationInMinutes; MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues(); this.cache = mapMaker.makeMap(); }
From source file:com.codingfingers.fastimagelist.cache.AbstractCache.java
protected MapMaker createMapMaker(int initialCapacity, long expirationInMinutes, int maxConcurrentThreads) { MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.expiration(expirationInMinutes * 60, TimeUnit.SECONDS); mapMaker.concurrencyLevel(maxConcurrentThreads); // mapMaker.softValues(); return mapMaker; }
From source file:com.hippoapp.asyncmvp.cache.AsyncCacheStorage.java
private void initInMemoryCache(int initialCapacity, int expirationInMinutes, int maxConcurrentThreads) { MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.expiration(expirationInMinutes * 60, TimeUnit.SECONDS); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues();//from w w w. ja v a 2 s. c om this.mCache = mapMaker.makeMap(); }
From source file:com.boardhood.mobile.cache.AbstractCache.java
/** * Creates a new cache instance./*from ww w .ja va2 s.c om*/ * * @param name * a human readable identifier for this cache. Note that this value will be used to * derive a directory name if the disk cache is enabled, so don't get too creative * here (camel case names work great) * @param initialCapacity * the initial element size of the cache * @param maxConcurrentThreads * how many threads you think may at once access the cache; this need not be an exact * number, but it helps in fragmenting the cache properly */ public AbstractCache(String name, int initialCapacity, int maxConcurrentThreads) { this.name = name; MapMaker mapMaker = new MapMaker(); mapMaker.initialCapacity(initialCapacity); mapMaker.concurrencyLevel(maxConcurrentThreads); mapMaker.softValues(); this.cache = mapMaker.makeMap(); }