Skip to content

Commit

Permalink
Update IndicesRequestCache.java
Browse files Browse the repository at this point in the history
Signed-off-by: Kiran Prakash <awskiran@amazon.com>
  • Loading branch information
kiranprakash154 committed Jun 17, 2024
1 parent 5a56ec1 commit 8a949d4
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,8 @@ private void updateStaleCountOnCacheInsert(CleanupKey cleanupKey) {

// pkg-private for testing
void addToCleanupKeyToCountMap(ShardId shardId, String readerCacheKeyId) {
cleanupKeyToCountMap.compute(shardId, (currentShardId, readerCacheKeyMap) -> {
final ConcurrentHashMap<String, Integer> updatedReaderCacheKeyMap = Objects.requireNonNullElseGet(
readerCacheKeyMap,
ConcurrentHashMap::new
);
updatedReaderCacheKeyMap.compute(readerCacheKeyId, (currentReaderCacheKeyId, count) -> (count == null) ? 1 : count + 1);
return updatedReaderCacheKeyMap;
});
cleanupKeyToCountMap.computeIfAbsent(shardId, k -> new ConcurrentHashMap<>())
.merge(readerCacheKeyId, 1, Integer::sum);
}

/**
Expand Down

0 comments on commit 8a949d4

Please sign in to comment.