File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/main/java/org/dataloader Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ Object getCallContext() {
7373
7474 Optional <CompletableFuture <V >> getIfPresent (K key ) {
7575 synchronized (dataLoader ) {
76- Object cacheKey = getCacheKey (nonNull (key ));
7776 boolean cachingEnabled = loaderOptions .cachingEnabled ();
7877 if (cachingEnabled ) {
78+ Object cacheKey = getCacheKey (nonNull (key ));
7979 if (futureCache .containsKey (cacheKey )) {
8080 stats .incrementCacheHitCount ();
8181 return Optional .of (futureCache .get (cacheKey ));
@@ -101,12 +101,12 @@ Optional<CompletableFuture<V>> getIfCompleted(K key) {
101101
102102 CompletableFuture <V > load (K key , Object loadContext ) {
103103 synchronized (dataLoader ) {
104- Object cacheKey = getCacheKey (nonNull (key ));
105- stats .incrementLoadCount ();
106-
107104 boolean batchingEnabled = loaderOptions .batchingEnabled ();
108105 boolean cachingEnabled = loaderOptions .cachingEnabled ();
109106
107+ Object cacheKey = cachingEnabled ? getCacheKey (nonNull (key )) : null ;
108+ stats .incrementLoadCount ();
109+
110110 if (cachingEnabled ) {
111111 if (futureCache .containsKey (cacheKey )) {
112112 stats .incrementCacheHitCount ();
You can’t perform that action at this time.
0 commit comments