public int replace ( Object dependency , ValueSet valueSet ) { int returnCode = HTODDynacache . NO_EXCEPTION ; dependencyNotUpdatedTable . remove ( dependency ) ; if ( valueSet != null && valueSet . size ( ) > this . delayOffloadEntriesLimit ) { dependencyToEntryTable . remove ( dependency ) ; if ( this . type == DEP_ID_TABLE ) { returnCode = this . htod . writeValueSet ( HTODDynacache . DEP_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; // valueSet may be empty after writeValueSet this . htod . cache . getCacheStatisticsListener ( ) . depIdsOffloadedToDisk ( dependency ) ; //System.out.println("***** replace dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this . htod . writeValueSet ( HTODDynacache . TEMPLATE_ID_DATA , dependency , valueSet , HTODDynacache . ALL ) ; // valueSet may be empty after writeValueSet this . htod . cache . getCacheStatisticsListener ( ) . templatesOffloadedToDisk ( dependency ) ; //System.out.println("***** replace template id=" + dependency + " size=" + valueSet.size()); } } else { if ( valueSet . size ( ) > 0 ) { dependencyToEntryTable . put ( dependency , valueSet ) ; } else { dependencyToEntryTable . remove ( dependency ) ; } } if ( returnCode == HTODDynacache . DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet . size ( ) > 0 ) { this . htod . delCacheEntry ( valueSet , CachePerf . DISK_OVERFLOW , CachePerf . LOCAL , ! Cache . FROM_DEPID_TEMPLATE_INVALIDATION , HTODInvalidationBuffer . FIRE_EVENT ) ; returnCode = HTODDynacache . NO_EXCEPTION ; } return returnCode ; }
This replaces the existing dependency with new valueSet in DependencyToEntryTable .