Skip to content

Releases: labd/node-dataloader-cache-wrapper

v0.4.0

09 Nov 13:36
Compare
Choose a tag to compare

Minor Changes

  • 8b10587: Properly support caching null values, and dont handle these as missing

v0.3.0

30 Apr 20:27
Compare
Choose a tag to compare

Minor Changes

  • 3fbea90: Move to keyv as cache implementation. This makes it compatible with various
    cache implementations. To update replace the client option with store and
    pass a Keyv instance.

import { dataloaderCache } from "@labdigital/dataloader-cache-wrapper"
import Keyv from 'keyv';

const redis = new Redis('redis://user:pass@localhost:6379');
const keyvRedis = new KeyvRedis(redis);

export const createProductBySlugLoader = () => {
return new DataLoader<ProductReference, any>(ProductDataLoader, {
maxBatchSize: 50,
});
};

export const ProductDataLoader = async
(keys: readonly any[]): Promise<(Product | null)[]> => {
return dataloaderCache(_uncachedProductDataLoader, keys, {
store: new Keyv({ store: keyvRedis }),
ttl: 3600,

  cacheKeysFn: (ref: ProductRef) => {
    const key = `${ref.store}-${ref.locale}-${ref.currency}`;
    return [`some-data:${key}:id:${ref.slug}`];
  },
})

}


## 0.2.0

### Minor Changes

- ffe9f26: Refactor to simplify the API by removing the lookupFn callback

## 0.1.1

### Patch Changes

- 0fd4457: Fix silly typo in latest change. bachLoadFn -> batchLoadFn

## 0.1.0

### Minor Changes

- 01243d5: Move all arguments to the options object for consistency
- dc082bf: Add support for adding a callback to prime the dataloader cache

## 0.0.5

### Patch Changes

- 822774e: Simplify the lookupFn function definition to improve the API

## 0.0.4

### Patch Changes

- 0edf554: Fix release artifact

## 0.0.3

### Patch Changes

- bedf41c: Fix ESM exports

## 0.0.2

### Patch Changes

- 95be409: Fix issue returning missing items from the dataloader

v0.2.0

14 Jan 21:31
Compare
Choose a tag to compare

Minor Changes

  • ffe9f26: Refactor to simplify the API by removing the lookupFn callback

v0.1.1

15 Nov 20:41
Compare
Choose a tag to compare

Patch Changes

  • 0fd4457: Fix silly typo in latest change. bachLoadFn -> batchLoadFn

v0.1.0

15 Nov 20:33
Compare
Choose a tag to compare

Minor Changes

  • 01243d5: Move all arguments to the options object for consistency
  • dc082bf: Add support for adding a callback to prime the dataloader cache

v0.0.5

18 Jul 14:08
Compare
Choose a tag to compare

Patch Changes

  • 822774e: Simplify the lookupFn function definition to improve the API

v0.0.4

18 Jul 13:43
Compare
Choose a tag to compare

Patch Changes

v0.0.3

18 Jul 12:35
Compare
Choose a tag to compare

Patch Changes

v0.0.2

08 Jun 14:23
Compare
Choose a tag to compare

Patch Changes

  • 95be409: Fix issue returning missing items from the dataloader