Skip to content

Commit fb4cf65

Browse files
committed
spillin
1 parent 5e649d7 commit fb4cf65

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ consistent API over various back-ends and reduce message communication overhead
1212

1313
An important use case for `java-dataloader` is improving the efficiency of GraphQL query execution. Graphql fields
1414
are resolved in a independent manner and with a true graph of objects, you may be fetching the same object many times.
15-
A naive implementation of graphql data fetchers can easily lead to the dreaded "n+1" fetch problem.
1615

17-
There are many other use cases where you can also benefit from using this utility.
16+
A naive implementation of graphql data fetchers can easily lead to the dreaded "n+1" fetch problem.
1817

1918
Most of the code is ported directly from Facebook's reference implementation, with one IMPORTANT adaptation to make
2019
it work for Java 8. ([more on this below](manual-dispatching)).
@@ -132,9 +131,10 @@ In this case the `userLoader.dispatchAndJoin()` is used to make a dispatch call,
132131
and then it repeats this until the data loader internal queue of keys is empty. At this point we have made 2 batched calls instead of the naive 4 calls we might have made if
133132
we did not "batch" the calls to load data.
134133

135-
## Batching requires batch backing APIs
134+
## Batching requires batched backing APIs
136135

137-
You will notice in our BatchLoader example that the backing service had the ability to get a list of users give a list of user ids in one call.
136+
You will notice in our BatchLoader example that the backing service had the ability to get a list of users given
137+
a list of user ids in one call.
138138

139139
```java
140140
public CompletionStage<List<User>> load(List<Long> userIds) {
@@ -144,8 +144,10 @@ You will notice in our BatchLoader example that the backing service had the abil
144144
}
145145
```
146146

147-
This is important consideration. By using `dataloader` you have batched up the request for N keys in a list of keys that can be retrieved at one time.
148-
If you don't have batch backing services, then you cant be as efficient as possible if you then have to make N calls for each key.
147+
This is important consideration. By using `dataloader` you have batched up the requests for N keys in a list of keys that can be
148+
retrieved at one time.
149+
150+
If you don't have batched backing services, then you cant be as efficient as possible as you will have to make N calls for each key.
149151

150152
```java
151153
BatchLoader<Long, User> lessEfficientUserBatchLoader = new BatchLoader<Long, User>() {
@@ -164,7 +166,7 @@ You will notice in our BatchLoader example that the backing service had the abil
164166

165167
```
166168

167-
That said, with key caching turn on (the default), it may still be more efficient using `dataloader` than without it
169+
That said, with key caching turn on (the default), it may still be more efficient using `dataloader` than without it.
168170

169171
## Differences to reference implementation
170172

0 commit comments

Comments
 (0)