下面列出了怎么用org.hibernate.cache.spi.TimestampsRegion的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public TimestampsRegion buildTimestampsRegion(
String regionName, SessionFactoryImplementor sessionFactory) {
verifyStarted();
return new TimestampsRegionTemplate(
regionName,
this,
createTimestampsRegionStorageAccess( regionName, sessionFactory )
);
}
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;
}
}
/** {@inheritDoc} */
@Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
return new HibernateTimestampsRegion(this,
regionName,
accessStgyFactory.node(),
accessStgyFactory.regionCache(regionName));
}
/** {@inheritDoc} */
@Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
return new HibernateTimestampsRegion(this,
regionName,
accessStgyFactory.node(),
accessStgyFactory.regionCache(regionName));
}
@Override
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException {
log.debug("Building timestamps cache region: " + regionName);
RMapCache<Object, Object> mapCache = getCache(regionName, properties, TIMESTAMPS_DEF);
return new RedissonTimestampsRegion(mapCache, ((Redisson)redisson).getConnectionManager(),this, properties, TIMESTAMPS_DEF);
}
public TimestampsCacheEnabledImpl(TimestampsRegion timestampsRegion) {
this.timestampsRegion = timestampsRegion;
}
@Override
public TimestampsRegion getRegion() {
return timestampsRegion;
}
@Override
public TimestampsRegion getRegion() {
return null;
}
@Override
public TimestampsCache buildTimestampsCache(
CacheImplementor cacheManager,
TimestampsRegion timestampsRegion) {
return new TimestampsCacheEnabledImpl( timestampsRegion );
}
@Override
public TimestampsRegion buildTimestampsRegion(
String regionName, SessionFactoryImplementor sessionFactory) {
throw new NoCacheRegionFactoryAvailableException();
}
/** {@inheritDoc} */
@Override public TimestampsRegion buildTimestampsRegion(String regionName, SessionFactoryImplementor sessFactory) {
return new IgniteTimestampsRegion(this, regionName, accessStgyFactory.node(),
accessStgyFactory.regionCache(regionName));
}