mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 08:05:05 +00:00
HHH-13527 Optimise DefaultLoadEventListener#getFromSharedCache hot path
This commit is contained in:
parent
3dbf0166fe
commit
eb1ab2cd9b
@ -731,23 +731,25 @@ private Object getFromSharedCache(
|
||||
final EntityPersister persister,
|
||||
SessionImplementor source ) {
|
||||
final EntityDataAccess cache = persister.getCacheAccessStrategy();
|
||||
final SessionFactoryImplementor factory = source.getFactory();
|
||||
final Object ck = cache.generateCacheKey(
|
||||
event.getEntityId(),
|
||||
persister,
|
||||
source.getFactory(),
|
||||
factory,
|
||||
source.getTenantIdentifier()
|
||||
);
|
||||
|
||||
final Object ce = CacheHelper.fromSharedCache( source, ck, persister.getCacheAccessStrategy() );
|
||||
if ( source.getFactory().getStatistics().isStatisticsEnabled() ) {
|
||||
final StatisticsImplementor statistics = factory.getStatistics();
|
||||
if ( statistics.isStatisticsEnabled() ) {
|
||||
if ( ce == null ) {
|
||||
source.getFactory().getStatistics().entityCacheMiss(
|
||||
statistics.entityCacheMiss(
|
||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
||||
cache.getRegion().getName()
|
||||
);
|
||||
}
|
||||
else {
|
||||
source.getFactory().getStatistics().entityCacheHit(
|
||||
statistics.entityCacheHit(
|
||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
||||
cache.getRegion().getName()
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user