Search in sources :

Example 1 with QueryResultsRegion

use of org.hibernate.cache.spi.QueryResultsRegion in project hibernate-orm by hibernate.

the class EnabledCaching method makeQueryResultsRegionAccess.

protected QueryResultsCache makeQueryResultsRegionAccess(String regionName) {
    final QueryResultsRegion region = (QueryResultsRegion) regionsByName.computeIfAbsent(regionName, this::makeQueryResultsRegion);
    final QueryResultsCacheImpl regionAccess = new QueryResultsCacheImpl(region, timestampsCache);
    namedQueryResultsCacheMap.put(regionName, regionAccess);
    legacySecondLevelCacheNames.add(regionName);
    return regionAccess;
}
Also used : QueryResultsRegion(org.hibernate.cache.spi.QueryResultsRegion)

Example 2 with QueryResultsRegion

use of org.hibernate.cache.spi.QueryResultsRegion in project hibernate-orm by hibernate.

the class CacheImpl method getQueryCache.

@Override
public QueryCache getQueryCache(String regionName) throws HibernateException {
    if (!settings.isQueryCacheEnabled()) {
        return null;
    }
    if (regionName == null) {
        return getDefaultQueryCache();
    }
    QueryCache queryCache = queryCaches.get(regionName);
    if (queryCache == null) {
        synchronized (queryCaches) {
            queryCache = queryCaches.get(regionName);
            if (queryCache == null) {
                final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(qualifyRegionName(regionName), sessionFactory.getProperties());
                queryCache = settings.getQueryCacheFactory().buildQueryCache(region, this);
                queryCaches.put(regionName, queryCache);
            }
        }
    }
    return queryCache;
}
Also used : QueryCache(org.hibernate.cache.spi.QueryCache) StandardQueryCache(org.hibernate.cache.internal.StandardQueryCache) QueryResultsRegion(org.hibernate.cache.spi.QueryResultsRegion)

Aggregations

QueryResultsRegion (org.hibernate.cache.spi.QueryResultsRegion)2 StandardQueryCache (org.hibernate.cache.internal.StandardQueryCache)1 QueryCache (org.hibernate.cache.spi.QueryCache)1