Skip to content

Commit 176f85f

Browse files
author
samvazquez
committed
feat: futureCache getAll in DataLoader
1 parent 1bc485b commit 176f85f

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/main/java/org/dataloader/CacheMap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.dataloader.impl.DefaultCacheMap;
2121

2222
import java.util.Collection;
23+
import java.util.Collections;
2324
import java.util.concurrent.CompletableFuture;
2425

2526
/**
@@ -75,7 +76,7 @@ static <K, V> CacheMap<K, V> simpleMap() {
7576
CompletableFuture<V> get(K key);
7677

7778
/**
78-
* Gets a collection of CompletableFutures of the cache map.
79+
* Gets a read-only collection of CompletableFutures of the cache map.
7980
* @return the collection of cached values
8081
*/
8182
Collection<CompletableFuture<V>> getAll();

src/main/java/org/dataloader/DataLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public Duration getTimeSinceDispatch() {
458458
* @return read-only collection of CompletableFutures
459459
*/
460460
public Collection<CompletableFuture<V>> getCacheFutures() {
461-
return helper.getCacheFutures();
461+
return Collections.unmodifiableCollection(futureCache.getAll());
462462
}
463463

464464
/**

src/main/java/org/dataloader/DataLoaderHelper.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.time.Instant;
1010
import java.util.ArrayList;
1111
import java.util.Collection;
12-
import java.util.Collections;
1312
import java.util.LinkedHashSet;
1413
import java.util.List;
1514
import java.util.Map;
@@ -100,10 +99,6 @@ public Instant getLastDispatchTime() {
10099
return lastDispatchTime.get();
101100
}
102101

103-
public Collection<CompletableFuture<V>> getCacheFutures() {
104-
return Collections.unmodifiableCollection(futureCache.getAll());
105-
}
106-
107102
Optional<CompletableFuture<V>> getIfPresent(K key) {
108103
synchronized (dataLoader) {
109104
boolean cachingEnabled = loaderOptions.cachingEnabled();

0 commit comments

Comments
 (0)