Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and mvantellingen committed Apr 30, 2024
1 parent d1b56c7 commit f83e8e3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
36 changes: 0 additions & 36 deletions .changeset/clean-bulldogs-cheat.md

This file was deleted.

37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# @labdigital/dataloader-cache-wrapper

## 0.3.0

### 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.

```ts


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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labdigital/dataloader-cache-wrapper",
"version": "0.2.0",
"version": "0.3.0",
"author": "Lab Digital <[email protected]>",
"license": "MIT",
"publishConfig": {
Expand Down

0 comments on commit f83e8e3

Please sign in to comment.