net.sf.ehcache.Ehcache.setStatisticsAccuracy()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中net.sf.ehcache.Ehcache.setStatisticsAccuracy()方法的一些代码示例,展示了Ehcache.setStatisticsAccuracy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ehcache.setStatisticsAccuracy()方法的具体详情如下:
包路径:net.sf.ehcache.Ehcache
类名称:Ehcache
方法名:setStatisticsAccuracy

Ehcache.setStatisticsAccuracy介绍

[英]Sets the statistics accuracy.
[中]设置统计信息的准确性。

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * {@inheritDoc}
 */
public void setStatisticsAccuracy(int statisticsAccuracy) {
  underlyingCache.setStatisticsAccuracy(statisticsAccuracy);
}

代码示例来源:origin: net.sf.ehcache/ehcache-explicitlocking

/**
 * Sets the statistics accuracy.
 * 
 * @param statisticsAccuracy
 *            one of {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_BEST_EFFORT} ,
 *            {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_GUARANTEED} ,
 *            {@link net.sf.ehcache.Statistics#STATISTICS_ACCURACY_NONE}
 */
public void setStatisticsAccuracy(int statisticsAccuracy) {
  cache.setStatisticsAccuracy(statisticsAccuracy);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
* {@inheritDoc}
*/
public void setStatisticsAccuracy(int arg0) {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    this.cache.setStatisticsAccuracy(arg0);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: com.madgag/mini-git-server-server

public void setStatisticsAccuracy(int statisticsAccuracy) {
 self().setStatisticsAccuracy(statisticsAccuracy);
}

代码示例来源:origin: rtyley/mini-git-server

public void setStatisticsAccuracy(int statisticsAccuracy) {
 self().setStatisticsAccuracy(statisticsAccuracy);
}

代码示例来源:origin: DSpace/DSpace

/**
 * Generate some stats for this cache.
 * Note that this is not cheap so do not use it very often.
 *
 * @param cache an Ehcache
 * @return the stats of this cache as a string
 */
protected static String generateCacheStats(Ehcache cache) {
  StringBuilder sb = new StringBuilder();
  sb.append(cache.getName()).append(":");
  // this will make this costly but it is important to get accurate settings
  cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_GUARANTEED);
  Statistics stats = cache.getStatistics();
  final long memSize = cache.getMemoryStoreSize();
  final long diskSize = cache.getDiskStoreSize();
  final long size = memSize + diskSize;
  final long hits = stats.getCacheHits();
  final long misses = stats.getCacheMisses();
  final String hitPercentage = ((hits + misses) > 0) ? ((100l * hits) / (hits + misses)) + "%" : "N/A";
  final String missPercentage = ((hits + misses) > 0) ? ((100l * misses) / (hits + misses)) + "%" : "N/A";
  sb.append("  Size: ").append(size).append(" [memory:").append(memSize).append(", disk:").append(diskSize)
   .append("]");
  sb.append(",  Hits: ").append(hits).append(" [memory:").append(stats.getInMemoryHits()).append(", disk:")
   .append(stats.getOnDiskHits()).append("] (").append(hitPercentage).append(")");
  sb.append(",  Misses: ").append(misses).append(" (").append(missPercentage).append(")");
  return sb.toString();
}

代码示例来源:origin: org.dspace/dspace-services-impl

/**
 * Generate some stats for this cache.
 * Note that this is not cheap so do not use it very often.
 *
 * @param cache an Ehcache
 * @return the stats of this cache as a string
 */
protected static String generateCacheStats(Ehcache cache) {
  StringBuilder sb = new StringBuilder();
  sb.append(cache.getName()).append(":");
  // this will make this costly but it is important to get accurate settings
  cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_GUARANTEED);
  Statistics stats = cache.getStatistics();
  final long memSize = cache.getMemoryStoreSize();
  final long diskSize = cache.getDiskStoreSize();
  final long size = memSize + diskSize;
  final long hits = stats.getCacheHits();
  final long misses = stats.getCacheMisses();
  final String hitPercentage = ((hits+misses) > 0) ? ((100l * hits) / (hits + misses)) + "%" : "N/A";
  final String missPercentage = ((hits+misses) > 0) ? ((100l * misses) / (hits + misses)) + "%" : "N/A";
  sb.append("  Size: ").append(size).append(" [memory:").append(memSize).append(", disk:").append(diskSize).append("]");
  sb.append(",  Hits: ").append(hits).append(" [memory:").append(stats.getInMemoryHits()).append(", disk:").append(stats.getOnDiskHits()).append("] (").append(hitPercentage).append(")");
  sb.append(",  Misses: ").append(misses).append(" (").append(missPercentage).append(")");
  return sb.toString();
}

代码示例来源:origin: org.dspace/dspace-services

/**
 * Generate some stats for this cache.
 * Note that this is not cheap so do not use it very often.
 *
 * @param cache an Ehcache
 * @return the stats of this cache as a string
 */
protected static String generateCacheStats(Ehcache cache) {
  StringBuilder sb = new StringBuilder();
  sb.append(cache.getName()).append(":");
  // this will make this costly but it is important to get accurate settings
  cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_GUARANTEED);
  Statistics stats = cache.getStatistics();
  final long memSize = cache.getMemoryStoreSize();
  final long diskSize = cache.getDiskStoreSize();
  final long size = memSize + diskSize;
  final long hits = stats.getCacheHits();
  final long misses = stats.getCacheMisses();
  final String hitPercentage = ((hits + misses) > 0) ? ((100l * hits) / (hits + misses)) + "%" : "N/A";
  final String missPercentage = ((hits + misses) > 0) ? ((100l * misses) / (hits + misses)) + "%" : "N/A";
  sb.append("  Size: ").append(size).append(" [memory:").append(memSize).append(", disk:").append(diskSize)
   .append("]");
  sb.append(",  Hits: ").append(hits).append(" [memory:").append(stats.getInMemoryHits()).append(", disk:")
   .append(stats.getOnDiskHits()).append("] (").append(hitPercentage).append(")");
  sb.append(",  Misses: ").append(misses).append(" (").append(missPercentage).append(")");
  return sb.toString();
}

相关文章

微信公众号

最新文章

更多

Ehcache类方法