Skip to content

Releases: graphql-java/java-dataloader

3.1.1

30 Oct 22:00
4253050
Compare
Choose a tag to compare

Small bugs fixes and the ability to prime the cache

3.1.0

11 Aug 02:21
8836d7e
Compare
Choose a tag to compare

ValueCache is called in batch function

The 3.x version of DataLoader added a long wanted feature. The ability to have an external cache of values.

It was rightly made an async operation to get cache entries.

However we got the code design wrong and called the caching during the dataLoader.load() calls and this broke the implied contract between loading N keys and being in a position to dispatch the batch loader and retrive N keys in batch.

This release fixes that - it moves the async caching get to the batch function itself, which is truly async.

This had a side benefit as well. The ValueCache now has a getValues(List<K> keys) method that allows a batch worth of keys to checked at once. External systems sucha s REDIS have multiple GET APIs and hence the caching can be even more efficient

graphql-java will now be able to update to this version in order to use the modern data loader with external value caching.

3.0.1

17 Jul 03:10
682c652
Compare
Choose a tag to compare

Bug fix release for a synchronized multithreaded issue

#89

3.0.0

06 Jul 11:37
f2457ec
Compare
Choose a tag to compare

Breaking Changes

  • the CacheMap signature has been changed to correctly reflect that it is a cache of CompletableFuture<V> and not just <V>

Other changes

  • a new ValueCache layer has been added to that allows values to be stored in external cache systems such as REDIS or long lived cross request systems like Caffeine

  • A new last dispatched time is present on DataLoaders

  • An experimental ScheduledDataLoaderRegistry that allows new ways to dispatch dataloaders.

2.2.3

25 Aug 07:18
Compare
Choose a tag to compare

This adds getIfPresent and getIfCompleted methods as well as a computeIfAbsent on DataLoaderRegistry for lazy loaders

2.2.0

23 Oct 08:19
Compare
Choose a tag to compare

This adds the ability to be passed a list of context load objects per batch key as well as a map of them

2.1.1

28 Aug 07:31
Compare
Choose a tag to compare

This adds new features into data loader to allow you to write more powerful batch loading functions

The first is returning a Map from batch loader function instead of an ordered list. This suits some use cases much more naturally

        MappedBatchLoaderWithContext<Long, User> mapBatchLoader = new MappedBatchLoaderWithContext<Long, User>() {
            @Override
            public CompletionStage<Map<Long, User>> load(Set<Long> userIds, BatchLoaderEnvironment environment) {
                SecurityCtx callCtx = environment.getContext();
                return CompletableFuture.supplyAsync(() -> userManager.loadMapOfUsersByIds(callCtx, userIds));
            }
        };

        DataLoader<Long, User> userLoader = DataLoader.newMappedDataLoader(mapBatchLoader);

        // ...

The second major change is that context can now be pushed into batch loading functions allowing you to get user credentials or database details for example

        DataLoaderOptions options = DataLoaderOptions.newOptions()
                .setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());

        BatchLoaderWithContext<String, String> batchLoader = new BatchLoaderWithContext<String, String>() {
            @Override
            public CompletionStage<List<String>> load(List<String> keys, BatchLoaderEnvironment environment) {
                SecurityCtx callCtx = environment.getContext();
                return callDatabaseForResults(callCtx, keys);
            }
        };

        DataLoader<String, String> loader = DataLoader.newDataLoader(batchLoader, options);

2.1.0

28 Aug 07:28
Compare
Choose a tag to compare

This release is borked. DO NOT USE. Use 2.1.1 instead

2.0.2

04 Dec 10:56
Compare
Choose a tag to compare
  • This fixes a bug where calling load while caching is disabled means the batch loader should get duplicate batch calls.

  • Also the synchronized code policy was changed

2.0.1

20 Sep 21:09
Compare
Choose a tag to compare
  • Adds new statistics capability so you can track what is happening inside your data loaders