private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess) { this.cacheAccess = cacheAccess; this.cacheLock = cacheAccess.lockRegion(); cacheAccess.removeAll(); }
boolean put = persister.getCacheAccessStrategy().putFromLoad( cacheKey, persister.getCacheEntryStructure().structure(entry), factory.getStatisticsImplementor().secondLevelCachePut( persister.getCacheAccessStrategy().getRegion().getName() );
public boolean containsCollection(String role, Serializable ownerIdentifier) { CollectionPersister p = getCollectionPersister( role ); return p.hasCache() && p.getCacheAccessStrategy().getRegion().contains( buildCacheKey( ownerIdentifier, p ) ); }
public void evictCollectionRegion(String role) { CollectionPersister p = getCollectionPersister( role ); if ( p.hasCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", p.getRole() ); } p.getCacheAccessStrategy().evictAll(); } }
public void evictCollection(String role, Serializable ownerIdentifier) { CollectionPersister p = getCollectionPersister( role ); if ( p.hasCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", MessageHelper.collectionInfoString( p, ownerIdentifier, SessionFactoryImpl.this ) ); } CacheKey cacheKey = buildCacheKey( ownerIdentifier, p ); p.getCacheAccessStrategy().evict( cacheKey ); } }
@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); persister.getCacheAccessStrategy().unlockItem( ck, lock ); } }
protected final void evict() throws CacheException { if ( persister.hasCache() ) { CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); persister.getCacheAccessStrategy().remove( ck ); } }
private boolean isCached(Serializable collectionKey, CollectionPersister persister) { if ( persister.hasCache() ) { CacheKey cacheKey = context.getSession().generateCacheKey( collectionKey, persister.getKeyType(), persister.getRole() ); return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null; } return false; } }
@Override public final void beforeExecutions() throws CacheException { // we need to obtain the lock before any actions are executed, since this may be an inverse="true" // bidirectional association and it is one of the earlier entity actions which actually updates // the database (this action is responsible for second-level cache invalidation only) if ( persister.hasCache() ) { final CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); final SoftLock lock = persister.getCacheAccessStrategy().lockItem( ck, null ); // the old behavior used key as opposed to getKey() afterTransactionProcess = new CacheCleanupProcess( key, persister, lock ); } }
boolean put = persister.getCacheAccessStrategy().putFromLoad( cacheKey, persister.getCacheEntryStructure().structure(entry), factory.getStatisticsImplementor().secondLevelCachePut( persister.getCacheAccessStrategy().getRegion().getName() );
public boolean containsCollection(String role, Serializable ownerIdentifier) { CollectionPersister p = getCollectionPersister( role ); return p.hasCache() && p.getCacheAccessStrategy().getRegion().contains( buildCacheKey( ownerIdentifier, p ) ); }
public void evictCollectionRegion(String role) { CollectionPersister p = getCollectionPersister( role ); if ( p.hasCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", p.getRole() ); } p.getCacheAccessStrategy().evictAll(); } }
public void evictCollection(String role, Serializable ownerIdentifier) { CollectionPersister p = getCollectionPersister( role ); if ( p.hasCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", MessageHelper.collectionInfoString( p, ownerIdentifier, SessionFactoryImpl.this ) ); } CacheKey cacheKey = buildCacheKey( ownerIdentifier, p ); p.getCacheAccessStrategy().evict( cacheKey ); } }
@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); persister.getCacheAccessStrategy().unlockItem( ck, lock ); } }
protected final void evict() throws CacheException { if ( persister.hasCache() ) { CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); persister.getCacheAccessStrategy().remove( ck ); } }
private boolean isCached(Serializable collectionKey, CollectionPersister persister) { if ( persister.hasCache() ) { CacheKey cacheKey = context.getSession().generateCacheKey( collectionKey, persister.getKeyType(), persister.getRole() ); return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null; } return false; } }
@Override public final void beforeExecutions() throws CacheException { // we need to obtain the lock before any actions are executed, since this may be an inverse="true" // bidirectional association and it is one of the earlier entity actions which actually updates // the database (this action is responsible for second-level cache invalidation only) if ( persister.hasCache() ) { final CacheKey ck = session.generateCacheKey( key, persister.getKeyType(), persister.getRole() ); final SoftLock lock = persister.getCacheAccessStrategy().lockItem( ck, null ); // the old behavior used key as opposed to getKey() afterTransactionProcess = new CacheCleanupProcess( key, persister, lock ); } }
private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess) { this.cacheAccess = cacheAccess; this.cacheLock = cacheAccess.lockRegion(); cacheAccess.removeAll(); }