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

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

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

Statistics.getQueryCacheHitCount介绍

[英]Get the global number of cached queries successfully retrieved from cache
[中]获取从缓存中成功检索到的缓存查询的全局数量

代码示例

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

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics( getEntityManagerFactory( args ) );
    return Long.valueOf( statistics != null ? statistics.getQueryCacheHitCount() : 0 );
  }
};

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

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

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

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

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

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

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

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

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

json.put("QueryExecutionMaxTime", statistics.getQueryExecutionMaxTime());
json.put("QueryExecutionMaxTimeQueryString", statistics.getQueryExecutionMaxTimeQueryString());
json.put("QueryCacheHitCount", statistics.getQueryCacheHitCount());
json.put("QueryCacheMissCount", statistics.getQueryCacheMissCount());
json.put("QueryCachePutCount", statistics.getQueryCachePutCount());

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

q.setParameter( "duration", 14l );
s.delete( q.list().get( 0 ) );
assertEquals( 1, stats.getQueryCacheHitCount() );
tx.commit();
s.close();

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

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

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

q.setCacheable( true );
q.list();
assertEquals( 1, stats.getQueryCacheHitCount() );
Night n2 = (Night) ( (Object[]) result.get( 0 ) )[0];
assertEquals( n2.getDuration(), n.getDuration() );

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

@TestForIssue(jiraKey = "HHH-4838")
@Test
public void testNaturalKeyLookupWithConstraint() {
  Session s = openSession();
  Transaction newTx = s.getTransaction();
  newTx.begin();
  A a1 = new A();
  a1.setName( "name1" );
  s.persist( a1 );
  newTx.commit();
  newTx = s.beginTransaction();
  getCriteria( s ).add( Restrictions.isNull( "singleD" ) ).uniqueResult(); // put query-result into cache
  A a2 = new A();
  a2.setName( "xxxxxx" );
  s.persist( a2 );
  newTx.commit();      // Invalidates space A in UpdateTimeStamps region
  newTx = s.beginTransaction();
  Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() );
  s.getSessionFactory().getStatistics().clear();
  // should not produce a hit in StandardQuery cache region because there is a constraint
  getCriteria( s ).add( Restrictions.isNull( "singleD" ) ).uniqueResult();
  Assert.assertEquals( 0, s.getSessionFactory().getStatistics().getQueryCacheHitCount() );
  s.createQuery( "delete from A" ).executeUpdate();
  newTx.commit();
  // Shutting down the application
  s.close();
}

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

Assert.assertEquals( 0, s.getSessionFactory().getStatistics().getQueryCacheHitCount() );
s.createQuery( "delete from A" ).executeUpdate();
s.createQuery( "delete from D" ).executeUpdate();

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

assertEquals(
    0,
    entityManagerFactory().unwrap( SessionFactory.class ).getStatistics().getQueryCacheHitCount()
);
    entityManagerFactory().unwrap( SessionFactory.class ).getStatistics().getQueryCacheHitCount()
);

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

Assert.assertEquals( 0, s.getSessionFactory().getStatistics().getQueryCacheHitCount() );
s.createQuery( "delete from A" ).executeUpdate();
s.createQuery( "delete from D" ).executeUpdate();

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public long getQueryCacheHitCount() {
  return stats.getQueryCacheHitCount();
}
public long getQueryExecutionMaxTime() {

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

public long getQueryCacheHitCount() {
  return stats.getQueryCacheHitCount();
}
public long getQueryExecutionMaxTime() {

代码示例来源:origin: org.jboss.as/jboss-as-jpa-hibernate4

@Override
  void handle(final ModelNode response, final String name, ManagementLookup stats, OperationContext context) {
    response.set(stats.getStatistics().getQueryCacheHitCount());
  }
});

代码示例来源:origin: org.jboss.eap/jipijapa-hibernate4-3

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

代码示例来源:origin: org.jipijapa/jipijapa-hibernate4-1

@Override
  public Object invoke(Object... args) {
    org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
    return Long.valueOf(statistics != null ? statistics.getQueryCacheHitCount() : 0);
  }
};

代码示例来源:origin: stackoverflow.com

Statistics stats = sessionFactory.getStatistics();
stats.setStatisticsEnabled(true);
... // do your work
long hitCount = stats.getQueryCacheHitCount();
long missCount = stats.getQueryCacheMissCount();

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

public void printStats() {
  System.out.println("query cache put count: " + sessionFactory.getStatistics().getQueryCachePutCount());
  System.out.println("query cache hit count: " + sessionFactory.getStatistics().getQueryCacheHitCount());
  System.out.println("query cache miss count: " + sessionFactory.getStatistics().getQueryCacheMissCount());
}

相关文章

Statistics类方法