本文整理汇总了Java中com.google.common.cache.AbstractCache.StatsCounter类的典型用法代码示例。如果您正苦于以下问题:Java StatsCounter类的具体用法?Java StatsCounter怎么用?Java StatsCounter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatsCounter类属于com.google.common.cache.AbstractCache包,在下文中一共展示了StatsCounter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(
LocalCache<K, V> map,
int initialCapacity,
long maxSegmentWeight,
StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null;
recencyQueue =
map.usesAccessQueue()
? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
writeQueue =
map.usesWriteQueue()
? new WriteQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
accessQueue =
map.usesAccessQueue()
? new AccessQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
}
开发者ID:antlr,项目名称:codebuff,代码行数:25,代码来源:LocalCache.java
示例2: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(
LocalCache<K, V> map,
int initialCapacity,
long maxSegmentWeight,
StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null;
recencyQueue = map.usesAccessQueue()
? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
writeQueue =
map.usesWriteQueue()
? new WriteQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
accessQueue =
map.usesAccessQueue()
? new AccessQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
}
开发者ID:antlr,项目名称:codebuff,代码行数:24,代码来源:LocalCache.java
示例3: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(LocalCache<K, V> map, int initialCapacity, long maxSegmentWeight, StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null;
recencyQueue =
map.usesAccessQueue()
? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
writeQueue =
map.usesWriteQueue()
? new WriteQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
accessQueue =
map.usesAccessQueue()
? new AccessQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
}
开发者ID:antlr,项目名称:codebuff,代码行数:21,代码来源:LocalCache.java
示例4: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(LocalCache<K, V> map, int initialCapacity, long maxSegmentWeight,
StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
keyReferenceQueue = map.usesKeyReferences()
? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences()
? new ReferenceQueue<V>() : null;
recencyQueue = map.usesAccessQueue()
? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
writeQueue = map.usesWriteQueue()
? new WriteQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
accessQueue = map.usesAccessQueue()
? new AccessQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
}
开发者ID:cplutte,项目名称:bts,代码行数:26,代码来源:LocalCache.java
示例5: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(LocalCache<K, V> map, int initialCapacity, long maxSegmentWeight, StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
// 构造队列,可以看到如果在builder没有配置,则不创建queue或者为空queue
keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null;
recencyQueue = map.usesAccessQueue() ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : LocalCache
.<ReferenceEntry<K, V>> discardingQueue();
writeQueue = map.usesWriteQueue() ? new WriteQueue<K, V>() : LocalCache
.<ReferenceEntry<K, V>> discardingQueue();
accessQueue = map.usesAccessQueue() ? new AccessQueue<K, V>() : LocalCache
.<ReferenceEntry<K, V>> discardingQueue();
}
开发者ID:ketao1989,项目名称:cnGuava,代码行数:21,代码来源:LocalCache.java
示例6: Segment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment(
LocalCache<K, V> map,
int initialCapacity,
long maxSegmentWeight,
StatsCounter statsCounter) {
this.map = map;
this.maxSegmentWeight = maxSegmentWeight;
this.statsCounter = checkNotNull(statsCounter);
initTable(newEntryArray(initialCapacity));
keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null;
valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null;
recencyQueue =
map.usesAccessQueue()
? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
writeQueue =
map.usesWriteQueue()
? new WriteQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
accessQueue =
map.usesAccessQueue()
? new AccessQueue<K, V>()
: LocalCache.<ReferenceEntry<K, V>>discardingQueue();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:30,代码来源:LocalCache.java
示例7: CapacityEnforcingLinkedHashMap
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
public CapacityEnforcingLinkedHashMap(
int initialCapacity,
float loadFactor,
boolean accessOrder,
long maximumSize,
StatsCounter statsCounter,
@Nullable RemovalListener removalListener) {
super(initialCapacity, loadFactor, accessOrder);
this.maximumSize = maximumSize;
this.statsCounter = statsCounter;
this.removalListener = removalListener;
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:13,代码来源:LocalCache.java
示例8: testEmptySimpleStats
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
public void testEmptySimpleStats() {
StatsCounter counter = new SimpleStatsCounter();
CacheStats stats = counter.snapshot();
assertEquals(0, stats.requestCount());
assertEquals(0, stats.hitCount());
assertEquals(1.0, stats.hitRate());
assertEquals(0, stats.missCount());
assertEquals(0.0, stats.missRate());
assertEquals(0, stats.loadSuccessCount());
assertEquals(0, stats.loadExceptionCount());
assertEquals(0, stats.loadCount());
assertEquals(0, stats.totalLoadTime());
assertEquals(0.0, stats.averageLoadPenalty());
assertEquals(0, stats.evictionCount());
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:16,代码来源:AbstractCacheTest.java
示例9: testSingleSimpleStats
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
public void testSingleSimpleStats() {
StatsCounter counter = new SimpleStatsCounter();
for (int i = 0; i < 11; i++) {
counter.recordHits(1);
}
for (int i = 0; i < 13; i++) {
counter.recordLoadSuccess(i);
}
for (int i = 0; i < 17; i++) {
counter.recordLoadException(i);
}
for (int i = 0; i < 23; i++) {
counter.recordMisses(1);
}
for (int i = 0; i < 27; i++) {
counter.recordEviction();
}
CacheStats stats = counter.snapshot();
int requestCount = 11 + 23;
assertEquals(requestCount, stats.requestCount());
assertEquals(11, stats.hitCount());
assertEquals(11.0 / requestCount, stats.hitRate());
int missCount = 23;
assertEquals(missCount, stats.missCount());
assertEquals(((double) missCount) / requestCount, stats.missRate());
assertEquals(13, stats.loadSuccessCount());
assertEquals(17, stats.loadExceptionCount());
assertEquals(13 + 17, stats.loadCount());
assertEquals(214, stats.totalLoadTime());
assertEquals(214.0 / (13 + 17), stats.averageLoadPenalty());
assertEquals(27, stats.evictionCount());
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:33,代码来源:AbstractCacheTest.java
示例10: CapacityEnforcingLinkedHashMap
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
public CapacityEnforcingLinkedHashMap(
int initialCapacity,
float loadFactor,
boolean accessOrder,
long maximumSize,
StatsCounter statsCounter,
@NullableDecl RemovalListener removalListener) {
super(initialCapacity, loadFactor, accessOrder);
this.maximumSize = maximumSize;
this.statsCounter = statsCounter;
this.removalListener = removalListener;
}
开发者ID:google,项目名称:guava,代码行数:13,代码来源:LocalCache.java
示例11: createSegment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment<K, V> createSegment(
int initialCapacity, long maxSegmentWeight, StatsCounter statsCounter) {
return new Segment<K, V>(this, initialCapacity, maxSegmentWeight, statsCounter);
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:LocalCache.java
示例12: getStatsCounterSupplier
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Supplier<? extends StatsCounter> getStatsCounterSupplier() {
return statsCounterSupplier;
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:4,代码来源:CacheBuilder.java
示例13: createSegment
import com.google.common.cache.AbstractCache.StatsCounter; //导入依赖的package包/类
Segment<K, V> createSegment(int initialCapacity, long maxSegmentWeight, StatsCounter statsCounter) {
return new Segment<K, V>(this, initialCapacity, maxSegmentWeight, statsCounter);
}
开发者ID:antlr,项目名称:codebuff,代码行数:4,代码来源:LocalCache.java
注:本文中的com.google.common.cache.AbstractCache.StatsCounter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论