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

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

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

Statistics.getNaturalIdCachePutCount介绍

[英]Get the global number of cacheable natural id lookups put in cache
[中]获取放置在缓存中的可缓存自然id查找的全局数量

代码示例

代码示例来源:origin: prometheus/client_java

@Override
 public double getValue(Statistics statistics) {
  return statistics.getNaturalIdCachePutCount();
 }
}

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

stats.clear();
assertEquals( "Cache hits should be empty", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "Cache puts should be empty", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

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

assertEquals( 2, session.getSessionFactory().getStatistics().getNaturalIdCachePutCount() );

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

stats.setStatisticsEnabled( true );
stats.clear();
assertEquals( "NaturalId cache puts should be zero", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId cache hits should be zero", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId cache misses should be zero", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() ); // one for Citizen, one for NaturalIdOnManyToOne
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

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

@Test
public void testNaturalIdLoaderNotCached() {
  saveSomeCitizens();
  Session s = openSession();
  Transaction tx = s.beginTransaction();
  State france = this.getState( s, "Ile de France" );
  final NaturalIdLoadAccess naturalIdLoader = s.byNaturalId( Citizen.class );
  naturalIdLoader.using( "ssn", "1234" ).using( "state", france );
  //NaturalId cache gets populated during entity loading, need to clear it out
  this.cleanupCache();
  Statistics stats = sessionFactory().getStatistics();
  stats.setStatisticsEnabled( true );
  stats.clear();
  assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
  assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
  // first query
  Citizen citizen = (Citizen)naturalIdLoader.load();
  assertNotNull( citizen );
  assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
  assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
  // cleanup
  tx.rollback();
  s.close();
}

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

assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

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

public long getNaturalIdCachePutCount() {
  return stats.getNaturalIdCachePutCount();
}

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

public long getNaturalIdCachePutCount() {
  return stats.getNaturalIdCachePutCount();
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
  assertEquals("NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount());
  assertEquals("NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount());
  assertEquals("NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount());
  assertEquals("NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount());
  assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
  assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
  assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
  assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

相关文章

Statistics类方法