Skip to content

Commit b7d2137

Browse files
committed
docs: add changesets
1 parent 6b96743 commit b7d2137

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.changeset/hip-cameras-kneel.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'bentocache': minor
3+
---
4+
5+
Enhance Factory Context by adding some new props.
6+
7+
```ts
8+
await cache.getOrSet({
9+
key: 'foo',
10+
factory: (ctx) => {
11+
// You can access the graced entry, if any, from the context
12+
if (ctx.gracedEntry?.value === 'bar') {
13+
return 'foo'
14+
}
15+
16+
// You should now use `setOptions` to update cache entry options
17+
ctx.setOptions({
18+
tags: ['foo'],
19+
ttl: '2s',
20+
skipL2Write: true,
21+
})
22+
23+
return 'foo';
24+
}
25+
})
26+
```
27+
28+
`setTtl` has been deprecated in favor of `setOptions` and will be removed in the next major version.

.changeset/stupid-moose-care.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'bentocache': minor
3+
---
4+
5+
Add `skipL2Write` and `skipBusNotify` options.
6+
7+
```ts
8+
await cache.getOrSet({
9+
key: 'foo',
10+
skipL2Write: true,
11+
skipBusNotify: true,
12+
factory: () => 'foo'
13+
})
14+
```
15+
16+
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 commit comments

Comments
 (0)