类org.hibernate.cache.spi.QueryResultsRegion源码实例Demo

下面列出了怎么用org.hibernate.cache.spi.QueryResultsRegion的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: StatisticsImpl.java
@Override
public CacheRegionStatisticsImpl getDomainDataRegionStatistics(String regionName) {
	if ( sessionFactory == null ) {
		return null;
	}

	return l2CacheStatsMap.computeIfAbsent(
			regionName,
			s -> {
				final Region region = sessionFactory.getCache().getRegion( regionName );

				if ( region == null ) {
					throw new IllegalArgumentException( "Unknown cache region : " + regionName );
				}

				if ( region instanceof QueryResultsRegion ) {
					throw new IllegalArgumentException(
							"Region name [" + regionName + "] referred to a query result region, not a domain data region"
					);
				}

				return new CacheRegionStatisticsImpl( region );
			}
	);
}
 
源代码2 项目: lams   文件: RegionFactoryTemplate.java
@Override
public QueryResultsRegion buildQueryResultsRegion(
		String regionName,
		SessionFactoryImplementor sessionFactory) {
	verifyStarted();
	return new QueryResultsRegionTemplate(
			regionName,
			this,
			createQueryResultsRegionStorageAccess( regionName, sessionFactory )
	);
}
 
源代码3 项目: lams   文件: EnabledCaching.java
public EnabledCaching(SessionFactoryImplementor sessionFactory) {
	this.sessionFactory = sessionFactory;

	this.regionFactory = getSessionFactory().getSessionFactoryOptions().getServiceRegistry().getService( RegionFactory.class );
	this.regionFactory.start( sessionFactory.getSessionFactoryOptions(), sessionFactory.getProperties() );

	if ( getSessionFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) {
		final TimestampsRegion timestampsRegion = regionFactory.buildTimestampsRegion(
				RegionFactory.DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME,
				sessionFactory
		);
		timestampsCache = sessionFactory.getSessionFactoryOptions()
				.getTimestampsCacheFactory()
				.buildTimestampsCache( this, timestampsRegion );
		legacySecondLevelCacheNames.add( timestampsRegion.getName() );

		final QueryResultsRegion queryResultsRegion = regionFactory.buildQueryResultsRegion(
				RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME,
				sessionFactory
		);
		regionsByName.put( queryResultsRegion.getName(), queryResultsRegion );
		defaultQueryResultsCache = new QueryResultsCacheImpl(
				queryResultsRegion,
				timestampsCache
		);
	}
	else {
		timestampsCache = new TimestampsCacheDisabledImpl();
		defaultQueryResultsCache = null;
	}
}
 
源代码4 项目: lams   文件: EnabledCaching.java
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;
}
 
源代码5 项目: lams   文件: EnabledCaching.java
protected QueryResultsRegion makeQueryResultsRegion(String regionName) {
	// make sure there is not an existing domain-data region with that name..
	final Region existing = regionsByName.get( regionName );
	if ( existing != null ) {
		if ( !QueryResultsRegion.class.isInstance( existing ) ) {
			throw new IllegalStateException( "Cannot store both domain-data and query-result-data in the same region [" + regionName );
		}

		throw new IllegalStateException( "Illegal call to create QueryResultsRegion - one already existed" );
	}

	return regionFactory.buildQueryResultsRegion( regionName, getSessionFactory() );
}
 
源代码6 项目: ignite   文件: HibernateRegionFactory.java
/** {@inheritDoc} */
@Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
    throws CacheException {
    return new HibernateQueryResultsRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName));
}
 
源代码7 项目: ignite   文件: HibernateRegionFactory.java
/** {@inheritDoc} */
@Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
    throws CacheException {
    return new HibernateQueryResultsRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName));
}
 
源代码8 项目: redisson   文件: RedissonRegionFactory.java
@Override
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException {
    log.debug("Building query cache region: " + regionName);
    
    RMapCache<Object, Object> mapCache = getCache(regionName, properties, QUERY_DEF);
    return new RedissonQueryRegion(mapCache, ((Redisson)redisson).getConnectionManager(),this, properties, QUERY_DEF);
}
 
源代码9 项目: lams   文件: QueryResultsCacheImpl.java
QueryResultsCacheImpl(
		QueryResultsRegion cacheRegion,
		TimestampsCache timestampsCache) {
	this.cacheRegion = cacheRegion;
	this.timestampsCache = timestampsCache;
}
 
源代码10 项目: lams   文件: QueryResultsCacheImpl.java
@Override
public QueryResultsRegion getRegion() {
	return cacheRegion;
}
 
源代码11 项目: lams   文件: NoCachingRegionFactory.java
@Override
public QueryResultsRegion buildQueryResultsRegion(
		String regionName, SessionFactoryImplementor sessionFactory) {
	throw new NoCacheRegionFactoryAvailableException();
}
 
源代码12 项目: ignite   文件: HibernateRegionFactory.java
/** {@inheritDoc} */
@Override public QueryResultsRegion buildQueryResultsRegion(String regionName, SessionFactoryImplementor sessFactory) {
    return new IgniteQueryResultsRegion(this, regionName, accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName));
}
 
 类所在包
 同包方法