public void onCacheHit ( String template , int locality ) { final String methodName = "onCacheHit()" ; CacheStatsModule csm = null ; if ( ( csm = getCSM ( template ) ) == null ) { return ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , methodName + " cacheName=" + _sCacheName + " template=" + template + " locality=" + locality + " enable=" + csm . _enable + " parentEnable=" + _enable + " " + this ) ; switch ( locality ) { case REMOTE : if ( csm . _enable ) { if ( csm . _remoteHitCount != null ) { csm . _remoteHitCount . increment ( ) ; } if ( csm . _inMemoryAndDiskCacheEntryCount != null ) { csm . _inMemoryAndDiskCacheEntryCount . increment ( ) ; } if ( csm . _remoteCreationCount != null ) { csm . _remoteCreationCount . increment ( ) ; } } break ; case MEMORY : if ( csm . _enable && csm . _hitsInMemoryCount != null ) csm . _hitsInMemoryCount . increment ( ) ; break ; case DISK : if ( _csmDisk != null && _csmDisk . _enable && _csmDisk . _hitsOnDisk != null ) { _csmDisk . _hitsOnDisk . increment ( ) ; } if ( csm . _enable && csm . _hitsOnDiskCount != null ) csm . _hitsOnDiskCount . increment ( ) ; break ; default : if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , methodName + " Error - Unrecognized locality " + locality + " cacheName=" + _sCacheName ) ; break ; } return ; }
Updates statistics for the cache hit case .