org.hibernate.cfg.Settings.isQueryCacheEnabled()方法的使用及代码示例

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

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

Settings.isQueryCacheEnabled介绍

暂无

代码示例

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

public void evictDefaultQueryRegion() {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictQueryRegion(String regionName) {
  if (regionName == null) throw new NullPointerException(
                              "Region-name cannot be null (use Cache#evictDefaultQueryRegion to evict the default query cache)");
  if (settings.isQueryCacheEnabled()) {
    QueryCache namedQueryCache = queryCaches.get(regionName);
    // TODO : cleanup entries in queryCaches + allCacheRegions ?
    if (namedQueryCache != null) namedQueryCache.clear();
  }
}

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

public void evictQueries() throws HibernateException {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictDefaultQueryRegion() {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictQueryRegion(String regionName) {
  if (regionName == null) throw new NullPointerException(
                              "Region-name cannot be null (use Cache#evictDefaultQueryRegion to evict the default query cache)");
  if (settings.isQueryCacheEnabled()) {
    QueryCache namedQueryCache = queryCaches.get(regionName);
    // TODO : cleanup entries in queryCaches + allCacheRegions ?
    if (namedQueryCache != null) namedQueryCache.clear();
  }
}

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

public void evictQueries() throws HibernateException {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictQueries() throws HibernateException {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictQueries() throws HibernateException {
  if ( settings.isQueryCacheEnabled() ) {
    queryCache.clear();
  }
}

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

public void evictQueries(String cacheRegion) throws HibernateException {
  if (cacheRegion==null) {
    throw new NullPointerException("use the zero-argument form to evict the default query cache");
  }
  else {
    synchronized (allCacheRegions) {
      if ( settings.isQueryCacheEnabled() ) {
        QueryCache currentQueryCache = (QueryCache) queryCaches.get(cacheRegion);
        if (currentQueryCache!=null) currentQueryCache.clear();
      }
    }            
  }
}

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

public void evictQueries(String cacheRegion) throws HibernateException {
  if (cacheRegion==null) {
    throw new NullPointerException("use the zero-argument form to evict the default query cache");
  }
  else {
    synchronized (allCacheRegions) {
      if ( settings.isQueryCacheEnabled() ) {
        QueryCache currentQueryCache = (QueryCache) queryCaches.get(cacheRegion);
        if ( currentQueryCache != null ) {
          currentQueryCache.clear();
        }
      }
    }
  }
}

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

public QueryCache getQueryCache(String cacheRegion) throws HibernateException {
  if (cacheRegion==null) {
    return getQueryCache();
  }
  
  if ( !settings.isQueryCacheEnabled() ) {
    return null;
  }
  synchronized (allCacheRegions) {
    QueryCache currentQueryCache = (QueryCache) queryCaches.get(cacheRegion);
    if (currentQueryCache==null) {
      currentQueryCache = settings.getQueryCacheFactory()
        .getQueryCache(cacheRegion, updateTimestampsCache, settings, properties);
      queryCaches.put(cacheRegion, currentQueryCache);
      allCacheRegions.put( currentQueryCache.getRegionName(), currentQueryCache.getCache() );
    }
    return currentQueryCache;
  }
}

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

public QueryCache getQueryCache(String cacheRegion) throws HibernateException {
  if (cacheRegion==null) {
    return getQueryCache();
  }
  if ( !settings.isQueryCacheEnabled() ) {
    return null;
  }
  synchronized (allCacheRegions) {
    QueryCache currentQueryCache = (QueryCache) queryCaches.get(cacheRegion);
    if (currentQueryCache==null) {
      currentQueryCache = settings.getQueryCacheFactory()
        .getQueryCache(cacheRegion, updateTimestampsCache, settings, properties);
      queryCaches.put(cacheRegion, currentQueryCache);
      allCacheRegions.put( currentQueryCache.getRegionName(), currentQueryCache.getCache() );
    }
    return currentQueryCache;
  }
}

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

/**
 * Return the query results, using the query cache, called
 * by subclasses that implement cacheable queries
 */
protected List list(
    final SessionImplementor session,
    final QueryParameters queryParameters,
    final Set querySpaces,
    final Type[] resultTypes) throws HibernateException {
  final boolean cacheable = factory.getSettings().isQueryCacheEnabled() && 
    queryParameters.isCacheable();
  if ( cacheable ) {
    return listUsingQueryCache( session, queryParameters, querySpaces, resultTypes );
  }
  else {
    return listIgnoreQueryCache( session, queryParameters );
  }
}

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

public void afterTransactionCompletion(boolean success) {
    for ( AfterTransactionCompletionProcess process : processes ) {
      try {
        process.doAfterTransactionCompletion( success, session );
      }
      catch ( CacheException ce ) {
        LOG.unableToReleaseCacheLock( ce );
        // continue loop
      }
      catch ( Exception e ) {
        throw new AssertionFailure( "Exception releasing cache locks", e );
      }
    }
    processes.clear();
    if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
      session.getFactory().getUpdateTimestampsCache().invalidate(
          querySpacesToInvalidate.toArray( new String[ querySpacesToInvalidate.size()] )
      );
    }
    querySpacesToInvalidate.clear();
  }
}

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

/**
 * Return the query results, using the query cache, called
 * by subclasses that implement cacheable queries
 */
protected List list(
    final SessionImplementor session,
    final QueryParameters queryParameters,
    final Set querySpaces,
    final Type[] resultTypes) throws HibernateException {
  final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
    queryParameters.isCacheable();
  if ( cacheable ) {
    return listUsingQueryCache( session, queryParameters, querySpaces, resultTypes );
  }
  else {
    return listIgnoreQueryCache( session, queryParameters );
  }
}

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

/**
 * Return the query results, using the query cache, called
 * by subclasses that implement cacheable queries
 */
protected List list(
    final SessionImplementor session,
    final QueryParameters queryParameters,
    final Set querySpaces,
    final Type[] resultTypes) throws HibernateException {
  final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
    queryParameters.isCacheable();
  if ( cacheable ) {
    return listUsingQueryCache( session, queryParameters, querySpaces, resultTypes );
  }
  else {
    return listIgnoreQueryCache( session, queryParameters );
  }
}

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

public void execute(Executable executable) {
  final boolean lockQueryCache = session.getFactory().getSettings().isQueryCacheEnabled();
  if ( executable.hasAfterTransactionCompletion() || lockQueryCache ) {
    executions.add( executable );
  }
  if (lockQueryCache) {
    session.getFactory()
      .getUpdateTimestampsCache()
      .preinvalidate( executable.getPropertySpaces() );
  }
  executable.execute();
}

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

public void execute(Executable executable) {
  final boolean lockQueryCache = session.getFactory().getSettings().isQueryCacheEnabled();
  if ( executable.hasAfterTransactionCompletion() || lockQueryCache ) {
    executions.add( executable );
  }
  if (lockQueryCache) {
    session.getFactory()
      .getUpdateTimestampsCache()
      .preinvalidate( executable.getPropertySpaces() );
  }
  executable.execute();
}

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

private void registerCleanupActions(Executable executable) {
  beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
  if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
    final String[] spaces = (String[]) executable.getPropertySpaces();
    if ( spaces != null && spaces.length > 0 ) { //HHH-6286
      afterTransactionProcesses.addSpacesToInvalidate( spaces );
      session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
    }
  }
  afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
}

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

private void registerCleanupActions(Executable executable) {
  beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
  if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
    final String[] spaces = (String[]) executable.getPropertySpaces();
    if ( spaces != null && spaces.length > 0 ) { //HHH-6286
      afterTransactionProcesses.addSpacesToInvalidate( spaces );
      session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
    }
  }
  afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
}

相关文章

Settings类方法