use of org.hibernate.cache.spi.QueryCache in project hibernate-orm by hibernate.
the class CacheImpl method close.
@Override
public void close() {
for (EntityRegionAccessStrategy access : entityRegionAccessStrategyMap.values()) {
access.getRegion().destroy();
}
for (CollectionRegionAccessStrategy access : collectionRegionAccessStrategyMap.values()) {
access.getRegion().destroy();
}
if (settings.isQueryCacheEnabled()) {
defaultQueryCache.destroy();
for (QueryCache cache : queryCaches.values()) {
cache.destroy();
}
updateTimestampsCache.destroy();
}
regionFactory.stop();
}
use of org.hibernate.cache.spi.QueryCache 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