You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ and Nicholas Schrock (@schrockn) from [Facebook](https://www.facebook.com/), the
52
52
- Deals with partial errors when a batch future fails
53
53
- Can disable batching and/or caching in configuration
54
54
- Can supply your own [`CacheMap<K, V>`](https://github.com/graphql-java/java-dataloader/blob/master/src/main/java/io/engagingspaces/vertx/dataloader/CacheMap.java) implementations
55
-
- Has very high test coverage (see [Acknowledgements](#acknowlegdements))
55
+
- Has very high test coverage
56
56
57
57
## Examples
58
58
@@ -399,17 +399,19 @@ and `NoOpStatisticsCollector`.
399
399
If you are serving web requests then the data can be specific to the user requesting it. If you have user specific data
400
400
then you will not want to cache data meant for user A to then later give it user B in a subsequent request.
401
401
402
-
The scope of your `DataLoader` instances is important. You might want to create them per web request to ensure data is only cached within that
402
+
The scope of your `DataLoader` instances is important. You will want to create them per web request to ensure data is only cached within that
403
403
web request and no more.
404
404
405
-
If your data can be shared across web requests then you might want to scope your data loaders so they survive longer than the web request say.
405
+
If your data can be shared across web requests then use a custom cache to keep values in a common place.
406
+
407
+
Data loaders are stateful components that contain promises (with context) that are likely share the same affinity as the request.
406
408
407
409
## Custom caches
408
410
409
-
The default cache behind `DataLoader` is an in memory `HashMap`. There is no expiry on this and it lives for as long as the data loader
411
+
The default cache behind `DataLoader` is an in memory `HashMap`. There is no expiry on this, and it lives for as long as the data loader
410
412
lives.
411
413
412
-
However you can create your own custom cache and supply it to the data loader on construction via the `org.dataloader.CacheMap` interface.
414
+
However, you can create your own custom cache and supply it to the data loader on construction via the `org.dataloader.CacheMap` interface.
0 commit comments