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

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

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

Ehcache.getStatistics介绍

[英]Gets an immutable Statistics object representing the Cache statistics at the time. How the statistics are calculated depends on the statistics accuracy setting. The only aspect of statistics sensitive to the accuracy setting is object size. How that is calculated is discussed below.

Best Effort Size

This result is returned when the statistics accuracy setting is Statistics#STATISTICS_ACCURACY_BEST_EFFORT.

The size is the number of Elements in the net.sf.ehcache.store.MemoryStore plus the number of Elements in the net.sf.ehcache.store.disk.DiskStore.

This number is the actual number of elements, including expired elements that have not been removed. Any duplicates between stores are accounted for.

Expired elements are removed from the the memory store when getting an expired element, or when attempting to spool an expired element to disk.

Expired elements are removed from the disk store when getting an expired element, or when the expiry thread runs, which is once every five minutes.

Guaranteed Accuracy Size

This result is returned when the statistics accuracy setting is Statistics#STATISTICS_ACCURACY_GUARANTEED.

This method accounts for elements which might be expired or duplicated between stores. It take approximately 200ms per 1000 elements to execute.

Fast but non-accurate Size

This result is returned when the statistics accuracy setting is Statistics#STATISTICS_ACCURACY_NONE.

The number given may contain expired elements. In addition if the DiskStore is used it may contain some double counting of elements. It takes 6ms for 1000 elements to execute. Time to execute is O(log n). 50,000 elements take 36ms.
[中]获取表示当时缓存统计信息的不可变统计信息对象。统计信息的计算方式取决于“统计信息准确性”设置。统计信息对精度设置唯一敏感的方面是对象大小。下面讨论如何计算。
####最大努力大小
当统计精度设置为统计#统计#精度(最佳努力)时,将返回此结果。
大小是网络中元素的数量。旧金山。ehcache。百货商店MemoryStore加上网络中的元素数。旧金山。ehcache。百货商店磁盘磁盘库。
此数字是元素的实际数量,包括尚未删除的过期元素。商店之间的任何重复都会被记录。
获取过期元素或尝试将过期元素假脱机到磁盘时,将从内存存储中删除过期元素。
获取过期元素时,或当过期线程运行时(每五分钟一次),会从磁盘存储中删除过期元素。
####保证精度尺寸
当“统计精度”设置为“统计#统计#精度#保证”时,将返回此结果。
此方法用于说明存储之间可能过期或重复的元素。每1000个元素执行大约需要200毫秒。
####快速但不精确的尺寸
当“统计精度”设置为“统计信息#统计信息_精度_无”时,将返回此结果。
给定的数字可能包含过期的元素。此外,如果使用DiskStore,它可能包含一些重复计算的元素。执行1000个元素需要6毫秒。执行时间为O(日志n)。50000个元素需要36毫秒。

代码示例

代码示例来源:origin: apache/kylin

@Override
  public Long getValue() {
    return cache.getStatistics().cacheEvictionOperation().count().value();
  }
});

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

/**
 * {@inheritDoc}
 */
@Override
public long getRemovedCount() {
  try {
    return cache.getStatistics().cacheRemoveCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getXaCommitCount() {
  try {
    return cache.getStatistics().xaCommitCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

代码示例来源:origin: apache/kylin

@Override
  public Double getValue() {
    return cache.getStatistics().cacheGetOperation().latency().average().value();
  }
});

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

/**
 * {@inheritDoc}
 */
@Override
public long getWriterQueueLength() {
  try {
    return cache.getStatistics().getWriterQueueLength();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

代码示例来源:origin: apache/kylin

@Override
  public Double getValue() {
    return cache.getStatistics().cacheSearchOperation().latency().average().value();
  }
});

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheHitCount() {
  try {
    return cache.getStatistics().cacheHitCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheExpirationRate() {
  return cache.getStatistics().cacheExpiredOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getOnDiskMissCount() {
  try {
    return cache.getStatistics().localDiskMissCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheHitRate() {
  return cache.getStatistics().cacheHitOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getEvictedCount() {
  try {
    return cache.getStatistics().cacheEvictedCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheMissRate() {
  return cache.getStatistics().cacheMissOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getInMemoryHitCount() {
  try {
    return cache.getStatistics().localHeapHitCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getTransactionRollbackRate() {
  return cache.getStatistics().xaRollbackOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getOffHeapHitCount() {
  try {
    return cache.getStatistics().localOffHeapHitCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheRemoveRate() {
  return cache.getStatistics().cacheRemoveOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getLocalOffHeapSize() {
  try {
    return cache.getStatistics().getLocalOffHeapSize();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheMissExpiredMostRecentSample() {
  return cache.getStatistics().cacheMissExpiredOperation().rate().value().longValue();
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getXaRecoveredCount() {
  try {
    return cache.getStatistics().xaRecoveryCount();
  } catch (RuntimeException e) {
    throw Utils.newPlainException(e);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public long getCacheOffHeapMissRate() {
  return cache.getStatistics().localOffHeapMissOperation().rate().value().longValue();
}

相关文章

Ehcache类方法