Skip to content

Commit 1aea107

Browse files
committed
chore: update readme with new syntax
1 parent c9a59f0 commit 1aea107

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/bentocache/README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ Multi-layer caching allows you to combine the speed of in-memory caching with th
7676

7777
Many drivers available to suit all situations: Redis, Upstash, Database (MySQL, SQLite, PostgreSQL), DynamoDB, Filesystem, In-memory (LRU Cache), Vercel KV...
7878

79-
See the [drivers documentation](https://bentocache.dev/docs/cache-drivers) for list of available drivers. Also very easy to extend the library and [add your own driver](https://bentocache.dev/docs/custom-cache-driver)
79+
See the [drivers documentation](https://bentocache.dev/docs/cache-drivers) for list of available drivers. Also, very easy to extend the library and [add your own driver](https://bentocache.dev/docs/custom-cache-driver)
8080

8181
### Resiliency
8282

8383
- [Grace period](https://bentocache.dev/docs/grace-periods): Keep your application running smoothly with the ability to temporarily use expired cache entries when your database is down, or when a factory is failing.
8484

8585
- [Cache stamped prevention](https://bentocache.dev/docs/stampede-protection): Ensuring that only one factory is executed at the same time.
8686

87-
- [Retry queue](https://bentocache.dev/docs/multi-tier#retry-queue-strategy) : When a application fails to publish something to the bus, it is added to a queue and retried later.
87+
- [Retry queue](https://bentocache.dev/docs/multi-tier#retry-queue-strategy) : When an application fails to publish something to the bus, it is added to a queue and retried later.
8888

8989
### Timeouts
9090

@@ -97,8 +97,8 @@ The ability to create logical groups for cache keys together, so you can invalid
9797
```ts
9898
const users = bento.namespace('users')
9999

100-
users.set('32', { name: 'foo' })
101-
users.set('33', { name: 'bar' })
100+
users.set({ key: '32', value: { name: 'foo' } })
101+
users.set({ key: '33', value: { name: 'bar' } })
102102

103103
users.clear()
104104
```
@@ -120,9 +120,11 @@ See the [events documentation](https://bentocache.dev/docs/events) for more info
120120
All TTLs can be passed in a human-readable string format. We use [lukeed/ms](https://github.com/lukeed/ms) under the hood. (this is optional, and you can pass a `number` in milliseconds if you prefer)
121121

122122
```ts
123-
bento.getOrSet('foo', () => getFromDb(), {
124-
ttl: '2.5h'
125-
gracePeriod: { enabled: true, duration: '6h' }
123+
bento.getOrSet({
124+
key: 'foo',
125+
factory: () => getFromDb(),
126+
ttl: '2.5h',
127+
grace: '6h',
126128
})
127129
```
128130

0 commit comments

Comments
 (0)