public CacheImpl(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; this.settings = sessionFactory.getSettings(); //todo should get this from service registry this.regionFactory = settings.getRegionFactory(); regionFactory.start( settings, sessionFactory.getProperties() ); if ( settings.isQueryCacheEnabled() ) { updateTimestampsCache = new UpdateTimestampsCache( settings, sessionFactory.getProperties(), sessionFactory ); queryCache = settings.getQueryCacheFactory() .getQueryCache( null, updateTimestampsCache, settings, sessionFactory.getProperties() ); queryCaches = new ConcurrentHashMap<String, QueryCache>(); allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() ); allCacheRegions.put( queryCache.getRegion().getName(), queryCache.getRegion() ); } else { updateTimestampsCache = null; queryCache = null; queryCaches = null; } }
/** * Constructs a StandardQueryCache instance * * @param settings The SessionFactory settings. * @param props Any properties * @param updateTimestampsCache The update-timestamps cache to use. * @param regionName The base query cache region name */ public StandardQueryCache( final Settings settings, final Properties props, final UpdateTimestampsCache updateTimestampsCache, final String regionName) { String regionNameToUse = regionName; if ( regionNameToUse == null ) { regionNameToUse = StandardQueryCache.class.getName(); } final String prefix = settings.getCacheRegionPrefix(); if ( prefix != null ) { regionNameToUse = prefix + '.' + regionNameToUse; } LOG.startingQueryCache( regionNameToUse ); this.cacheRegion = settings.getRegionFactory().buildQueryResultsRegion( regionNameToUse, props ); this.updateTimestampsCache = updateTimestampsCache; }
@Override public QueryCache getQueryCache( final String regionName, final UpdateTimestampsCache updateTimestampsCache, final Settings settings, final Properties props) throws HibernateException { return new StandardQueryCache(settings, props, updateTimestampsCache, regionName); }
public UpdateTimestampsCache getUpdateTimestampsCache() { return sessionFactoryImplementor.getUpdateTimestampsCache(); }
@Override public UpdateTimestampsCache getUpdateTimestampsCache() { return updateTimestampsCache; }
public UpdateTimestampsCache getUpdateTimestampsCache() { return cacheAccess.getUpdateTimestampsCache(); }
/** * Get the cache of table update timestamps */ public UpdateTimestampsCache getUpdateTimestampsCache();
/** * Get {@code UpdateTimestampsCache} instance managed by the {@code SessionFactory}. */ public UpdateTimestampsCache getUpdateTimestampsCache();