this.multiFactor = multiFactor; this.memoryFactor = memoryFactor; this.stats = new CacheStats(this.getClass().getSimpleName()); this.count = new AtomicLong(0); this.elements = new AtomicLong(0);
@Test public void testCombinedCacheStats() { CacheStats lruCacheStats = new CacheStats("lruCacheStats", 2); CacheStats bucketCacheStats = new CacheStats("bucketCacheStats", 2); CombinedCacheStats stats = new CombinedCacheStats(lruCacheStats, bucketCacheStats);
CacheStats stats = new CacheStats("test", 3);
/** * Default constructor, creates an empty SlabCache. * * @param size Total size allocated to the SlabCache. (Bytes) * @param avgBlockSize Average size of a block being cached. **/ public SlabCache(long size, long avgBlockSize) { this.avgBlockSize = avgBlockSize; this.size = size; this.stats = new CacheStats(); this.requestStats = new SlabStats(); this.successfullyCachedStats = new SlabStats(); backingStore = new ConcurrentHashMap<BlockCacheKey, SingleSizeCache>(); sizer = new TreeMap<Integer, SingleSizeCache>(); this.scheduleThreadPool.scheduleAtFixedRate(new StatisticsThread(this), STAT_THREAD_PERIOD_SECS, STAT_THREAD_PERIOD_SECS, TimeUnit.SECONDS); }
this.numBlocks = numBlocks; backingStore = new Slab(blockSize, numBlocks); this.stats = new CacheStats(); this.actionWatcher = master; this.size = new AtomicLong(CACHE_FIXED_OVERHEAD + backingStore.heapSize());
this.multiFactor = multiFactor; this.memoryFactor = memoryFactor; this.stats = new CacheStats(); this.count = new AtomicLong(0); this.elements = new AtomicLong(0);
this.multiFactor = multiFactor; this.memoryFactor = memoryFactor; this.stats = new CacheStats(this.getClass().getSimpleName()); this.count = new AtomicLong(0); this.elements = new AtomicLong(0);
/** * Default constructor. Specify maximum size and expected average block size * (approximation is fine). * <p> * All other factors will be calculated based on defaults specified in this * class. * * @param onHeapSize maximum size of the onHeapCache, in bytes. * @param offHeapSize maximum size of the offHeapCache, in bytes. * @param onHeapBlockSize average block size of the on heap cache. * @param offHeapBlockSize average block size for the off heap cache * @param conf configuration file. currently used only by the off heap cache. */ public DoubleBlockCache(long onHeapSize, long offHeapSize, long onHeapBlockSize, long offHeapBlockSize, Configuration conf) { LOG.info("Creating on-heap cache of size " + StringUtils.humanReadableInt(onHeapSize) + "bytes with an average block size of " + StringUtils.humanReadableInt(onHeapBlockSize) + " bytes."); onHeapCache = new LruBlockCache(onHeapSize, onHeapBlockSize, conf); LOG.info("Creating off-heap cache of size " + StringUtils.humanReadableInt(offHeapSize) + "bytes with an average block size of " + StringUtils.humanReadableInt(offHeapBlockSize) + " bytes."); offHeapCache = new SlabCache(offHeapSize, offHeapBlockSize); offHeapCache.addSlabByConf(conf); this.stats = new CacheStats(); }
@Test public void testCombinedCacheStats() { CacheStats lruCacheStats = new CacheStats("lruCacheStats", 2); CacheStats bucketCacheStats = new CacheStats("bucketCacheStats", 2); CombinedCacheStats stats = new CombinedCacheStats(lruCacheStats, bucketCacheStats);
CacheStats stats = new CacheStats("test", 3);