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;
}
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;
}
Aggregations