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() {
73
73
74
74
Optional <CompletableFuture <V >> getIfPresent (K key ) {
75
75
synchronized (dataLoader ) {
76
- Object cacheKey = getCacheKey (nonNull (key ));
77
76
boolean cachingEnabled = loaderOptions .cachingEnabled ();
78
77
if (cachingEnabled ) {
78
+ Object cacheKey = getCacheKey (nonNull (key ));
79
79
if (futureCache .containsKey (cacheKey )) {
80
80
stats .incrementCacheHitCount ();
81
81
return Optional .of (futureCache .get (cacheKey ));
@@ -101,12 +101,12 @@ Optional<CompletableFuture<V>> getIfCompleted(K key) {
101
101
102
102
CompletableFuture <V > load (K key , Object loadContext ) {
103
103
synchronized (dataLoader ) {
104
- Object cacheKey = getCacheKey (nonNull (key ));
105
- stats .incrementLoadCount ();
106
-
107
104
boolean batchingEnabled = loaderOptions .batchingEnabled ();
108
105
boolean cachingEnabled = loaderOptions .cachingEnabled ();
109
106
107
+ Object cacheKey = cachingEnabled ? getCacheKey (nonNull (key )) : null ;
108
+ stats .incrementLoadCount ();
109
+
110
110
if (cachingEnabled ) {
111
111
if (futureCache .containsKey (cacheKey )) {
112
112
stats .incrementCacheHitCount ();
You can’t perform that action at this time.
0 commit comments