Skip to content

Commit 488e48b

Browse files
Merge pull request #130 from planetscale/mscoutermarsh-patch-1
Add usage instructions with boost
2 parents 254ef0d + 0cf4ccc commit 488e48b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ const results = await conn.transaction(async (tx) => {
8080
console.log(results)
8181
```
8282

83+
### Usage with PlanetScale Boost
84+
85+
To enable PlanetScale Boost, run `SET @@boost_cached_queries = true` once. All subsequent queries run on the same connection will use boost if it's enabled for the query pattern. Non-matching queries will run as normal.
86+
87+
To learn more, visit: [Query caching with PlanetScale Boost](https://planetscale.com/docs/concepts/query-caching-with-planetscale-boost)
88+
89+
```ts
90+
const conn = client.connection()
91+
// Enable boost for the connection
92+
await conn.execute('SET @@boost_cached_queries = true')
93+
94+
const results = await conn.execute('...')
95+
96+
// Optionally, you may disable boost for the connection by setting to false
97+
await conn.execute('SET @@boost_cached_queries = false')
98+
```
99+
83100
### Custom fetch function
84101

85102
Node.js version 18 includes a built-in global `fetch` function. When using an older version of Node.js, you can provide a custom fetch function implementation. We recommend the [`undici`][1] package on which Node's built-in fetch is based.

0 commit comments

Comments
 (0)