Skip to content

Commit

Permalink
docs: add changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Feb 16, 2025
1 parent 6b96743 commit b7d2137
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .changeset/hip-cameras-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'bentocache': minor
---

Enhance Factory Context by adding some new props.

```ts
await cache.getOrSet({
key: 'foo',
factory: (ctx) => {
// You can access the graced entry, if any, from the context
if (ctx.gracedEntry?.value === 'bar') {
return 'foo'
}

// You should now use `setOptions` to update cache entry options
ctx.setOptions({
tags: ['foo'],
ttl: '2s',
skipL2Write: true,
})

return 'foo';
}
})
```

`setTtl` has been deprecated in favor of `setOptions` and will be removed in the next major version.
16 changes: 16 additions & 0 deletions .changeset/stupid-moose-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'bentocache': minor
---

Add `skipL2Write` and `skipBusNotify` options.

```ts
await cache.getOrSet({
key: 'foo',
skipL2Write: true,
skipBusNotify: true,
factory: () => 'foo'
})
```

When enabled, `skipL2Write` will prevent the entry from being written to L2 cache, and `skipBusNotify` will prevent any notification from being sent to the bus. You will probably never need to use these options, but they were useful for internal code, so decided to expose them.

0 comments on commit b7d2137

Please sign in to comment.