Skip to content

Commit

Permalink
Adding write locks to refresh API as well
Browse files Browse the repository at this point in the history
Signed-off-by: Sagar Upadhyaya <[email protected]>
  • Loading branch information
sgup432 committed Jan 3, 2024
1 parent 1832df9 commit 49aab1f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,14 @@ public Iterable<K> cacheKeys(CacheStoreType type) {
public void refresh(CacheStoreType type) {
switch (type) {
case ON_HEAP:
onHeapCache.refresh();
try (ReleasableLock ignore = writeLock.acquire()) {
onHeapCache.refresh();
}
break;
case DISK:
onDiskCache.ifPresent(ICache::refresh);
try (ReleasableLock ignore = writeLock.acquire()) {
onDiskCache.ifPresent(ICache::refresh);
}
break;
default:
throw new IllegalArgumentException("Unsupported Cache store type: " + type);
Expand Down

0 comments on commit 49aab1f

Please sign in to comment.