org.hibernate.stat.Statistics.getNaturalIdCacheStatistics()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(83)

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

Statistics.getNaturalIdCacheStatistics介绍

[英]Natural id cache statistics per region
[中]每个区域的自然id缓存统计信息

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testLegacyStatsApi() {
  // these references need to be the prefixed name
  final String regionName = cachePrefix + '.' + localName;
  final Statistics stats = sessionFactory().getStatistics();
  assertEquals( 2, stats.getSecondLevelCacheRegionNames().length );
  final SecondLevelCacheStatistics secondLevelCacheStatistics = stats.getSecondLevelCacheStatistics( regionName );
  assert secondLevelCacheStatistics != null;
  final NaturalIdCacheStatistics naturalIdCacheStatistics = stats.getNaturalIdCacheStatistics( regionName );
  assert naturalIdCacheStatistics != null;
  final SecondLevelCacheStatistics dne = stats.getSecondLevelCacheStatistics( cachePrefix + ".does.not.exist" );
  assert dne != null;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName) {
  return stats.getNaturalIdCacheStatistics( regionName );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName) {
  return stats.getNaturalIdCacheStatistics( regionName );
}

代码示例来源:origin: at.chrl/chrl-orm

public static String[] getCacheStatistics(final SessionFactory sessionFactory, final String cacheRegion) {
  if (isNull(sessionFactory))
    throw new NullPointerException("Parameter sessionFactory is null");
  if (isNull(cacheRegion))
    throw new NullPointerException("Parameter cacheRegion is null");
  if (cacheRegion.isEmpty())
    throw new IllegalArgumentException("Parameter cacheRegion is a empty String");
  final Statistics sfstats = sessionFactory.getStatistics();
  if (!ArrayUtils.contains(sfstats.getSecondLevelCacheRegionNames(), cacheRegion))
    throw new IllegalArgumentException("Cache Region" + cacheRegion + " is not managed by given SessionFactory");
  final SecondLevelCacheStatistics stats = sfstats.getSecondLevelCacheStatistics(cacheRegion);
  final NaturalIdCacheStatistics idstats = sfstats.getNaturalIdCacheStatistics(cacheRegion);
  return new String[] { "+ 2nd Level Cache Statistics: " + cacheRegion, "+", "+ # Puts: " + stats.getPutCount(), "+ # Hits: " + stats.getHitCount(), "+ # Misses: " + stats.getMissCount(), "+ Hit Ratio: " + ((double) stats.getHitCount()) / (stats.getHitCount() + stats.getMissCount()), "+ Size in Memory: " + stats.getSizeInMemory(), "+ Elements in Memory: " + stats.getElementCountInMemory(), "+ Elements on Disk: " + stats.getElementCountOnDisk(), "+", "+ ID # Puts: " + idstats.getPutCount(), "+ ID # Hits: " + idstats.getHitCount(), "+ ID # Misses: " + idstats.getMissCount(), "+ ID Hit Ratio: " + ((double) idstats.getHitCount()) / (idstats.getHitCount() + idstats.getMissCount()), "+ ID Size in Memory: " + idstats.getSizeInMemory(), "+ ID Elements in Memory: " + idstats.getElementCountInMemory(), "+ ID Execution Count: " + idstats.getExecutionCount(), "+ ID Avg Execution Time: " + idstats.getExecutionAvgTime() + "ms", "+ ID Max Execution Time: " + idstats.getExecutionMaxTime() + "ms", "+ ID Min Execution Time: " + idstats.getExecutionMinTime() + "ms", "+", "+" };
}

相关文章

Statistics类方法