Skip to content

Commit

Permalink
Merge pull request #5511 from tkafalas/feature
Browse files Browse the repository at this point in the history
[BACKLOG-39705] Remove from Region Cache not removing 1st level cache…
  • Loading branch information
peterrinehart authored Jan 31, 2024
2 parents 80a576b + 292ed29 commit f6a8432
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -315,10 +315,13 @@ public boolean addCacheRegion( String region, Cache cache ) {

public void clearRegionCache( String region ) {
if ( checkCacheEnabled() ) {
Cache cache = regionCache.get( region );
HvCache cache = (HvCache) regionCache.get( region );
if ( cache != null ) {
try {
cache.evictAll();
try ( SessionImpl session = (SessionImpl) cache.getSessionFactory().openSession() ) {
cache.getStorageAccess().clearCache( session );
cache.evictAll();
}
} catch ( CacheException e ) {
CacheManager.logger.error( Messages.getInstance().getString(
"CacheManager.ERROR_0006_CACHE_EXCEPTION", e.getLocalizedMessage() ) ); //$NON-NLS-1$
@@ -400,7 +403,10 @@ public Set getAllEntriesFromRegionCache( String region ) {
public void removeFromRegionCache( String region, Object key ) {
if ( checkRegionEnabled( region ) ) {
HvCache hvcache = (HvCache) regionCache.get( region );
hvcache.evictEntityData( (String) key );
try ( SessionImpl session = (SessionImpl) hvcache.getSessionFactory().openSession() ) {
hvcache.getStorageAccess().removeFromCache( key, session );
hvcache.evictEntityData( (String) key );
}
} else {
CacheManager.logger.warn( Messages.getInstance().getString(
"CacheManager.WARN_0003_REGION_DOES_NOT_EXIST", region ) ); //$NON-NLS-1$

0 comments on commit f6a8432

Please sign in to comment.