当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getCacheRegionPrefix方法代码示例

本文整理汇总了Java中org.hibernate.cfg.Settings.getCacheRegionPrefix方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getCacheRegionPrefix方法的具体用法?Java Settings.getCacheRegionPrefix怎么用?Java Settings.getCacheRegionPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.cfg.Settings的用法示例。


在下文中一共展示了Settings.getCacheRegionPrefix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: StandardQueryCache

import org.hibernate.cfg.Settings; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:StandardQueryCache.java

示例2: StandardQueryCache

import org.hibernate.cfg.Settings; //导入方法依赖的package包/类
public StandardQueryCache(
		final Settings settings, 
		final Properties props, 
		final UpdateTimestampsCache updateTimestampsCache, 
		String regionName) throws HibernateException {
	if ( regionName == null ) {
		regionName = StandardQueryCache.class.getName();
	}
	String prefix = settings.getCacheRegionPrefix();
	if ( prefix != null ) {
		regionName = prefix + '.' + regionName;
	}
	log.info( "starting query cache at region: " + regionName );

	this.queryCache = settings.getCacheProvider().buildCache(regionName, props);
	this.updateTimestampsCache = updateTimestampsCache;
	this.regionName = regionName;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:19,代码来源:StandardQueryCache.java

示例3: UpdateTimestampsCache

import org.hibernate.cfg.Settings; //导入方法依赖的package包/类
/**
 * Constructs an UpdateTimestampsCache.
 *
 * @param settings The SessionFactory settings
 * @param props Any properties
 * @param factory The SessionFactory
 */
public UpdateTimestampsCache(Settings settings, Properties props, final SessionFactoryImplementor factory) {
	this.factory = factory;
	final String prefix = settings.getCacheRegionPrefix();
	final String regionName = prefix == null ? REGION_NAME : prefix + '.' + REGION_NAME;

	LOG.startingUpdateTimestampsCache( regionName );
	this.region = settings.getRegionFactory().buildTimestampsRegion( regionName, props );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:UpdateTimestampsCache.java

示例4: createCache

import org.hibernate.cfg.Settings; //导入方法依赖的package包/类
public static CacheConcurrencyStrategy createCache(
	final String concurrencyStrategy, 
	String regionName, 
	final boolean mutable, 
	final Settings settings,
	final Properties properties) 
throws HibernateException {
	
	if ( concurrencyStrategy==null || !settings.isSecondLevelCacheEnabled() ) return null; //no cache
	
	String prefix = settings.getCacheRegionPrefix();
	if ( prefix!=null ) regionName = prefix + '.' + regionName;
	
	if ( log.isDebugEnabled() ) log.debug("instantiating cache region: " + regionName + " usage strategy: " + concurrencyStrategy);
	
	final CacheConcurrencyStrategy ccs;
	if ( concurrencyStrategy.equals(READ_ONLY) ) {
		if (mutable) log.warn( "read-only cache configured for mutable class: " + regionName );
		ccs = new ReadOnlyCache();
	}
	else if ( concurrencyStrategy.equals(READ_WRITE) ) {
		ccs = new ReadWriteCache();
	}
	else if ( concurrencyStrategy.equals(NONSTRICT_READ_WRITE) ) {
		ccs = new NonstrictReadWriteCache();
	}
	else if ( concurrencyStrategy.equals(TRANSACTIONAL) ) {
		ccs = new TransactionalCache();
	}
	else {
		throw new MappingException("cache usage attribute should be read-write, read-only, nonstrict-read-write or transactional");
	}
	
	final Cache impl;
	try {
		impl = settings.getCacheProvider().buildCache(regionName, properties);
	}
	catch (CacheException e) {
		throw new HibernateException( "Could not instantiate cache implementation", e );
	}
	ccs.setCache(impl);
	
	return ccs;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:45,代码来源:CacheFactory.java

示例5: UpdateTimestampsCache

import org.hibernate.cfg.Settings; //导入方法依赖的package包/类
public UpdateTimestampsCache(Settings settings, Properties props) throws HibernateException {
	String prefix = settings.getCacheRegionPrefix();
	regionName = prefix == null ? REGION_NAME : prefix + '.' + REGION_NAME;
	log.info( "starting update timestamps cache at region: " + regionName );
	this.updateTimestamps = settings.getCacheProvider().buildCache( regionName, props );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:UpdateTimestampsCache.java


注:本文中的org.hibernate.cfg.Settings.getCacheRegionPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。