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

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

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

Statistics.getQueryPlanCacheMissCount介绍

[英]Get the global number of query plans lookups not found in cache
[中]获取在缓存中找到的查询计划查找的全局数

代码示例

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

assertEquals( 0, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 1, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 1, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 1, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 2, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 2, statistics.getQueryPlanCacheMissCount() );
  assertEquals( 2, statistics.getQueryPlanCacheMissCount() );

代码示例来源:origin: vladmihalcea/high-performance-java-persistence

@Test
public void testInQueryCachePlan() {
  SessionFactory sessionFactory = entityManagerFactory().unwrap(SessionFactory.class);
  Statistics statistics = sessionFactory.getStatistics();
  statistics.clear();
  doInJPA(entityManager -> {
    for (int i = 2; i < 16; i++) {
      getPostByIds(
          entityManager,
          IntStream.range(1, i).boxed().toArray(Integer[]::new)
      );
    }
    assertEquals(6L, statistics.getQueryPlanCacheMissCount());
    for (String query : statistics.getQueries()) {
      LOGGER.info("Executed query: {}", query);
    }
  });
}

代码示例来源:origin: vladmihalcea/high-performance-java-persistence

@Test
public void testInQueryCachePlan() {
  SessionFactory sessionFactory = entityManagerFactory().unwrap(SessionFactory.class);
  Statistics statistics = sessionFactory.getStatistics();
  statistics.clear();
  doInJPA(entityManager -> {
    for (int i = 1; i < 16; i++) {
      getPostByIds(
        entityManager,
        IntStream.range(1, i + 1).boxed().toArray(Integer[]::new)
      );
    }
  });
  assertEquals(16L, statistics.getQueryPlanCacheMissCount());
  for (String query : statistics.getQueries()) {
    LOGGER.info("Executed query: {}", query);
  }
}

相关文章

Statistics类方法