Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 21, 2024
1 parent 882f0a9 commit 00c308c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/1.guide/6.cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ The stars will be cached in development inside **.nitro/cache/functions/ghStars/
You can also use the `cachedFunction` method as alias of `defineCachedFunction`.
::

### Serverless environment
### Edge workers

In a serverless environment, the instance is destroyed after each request. Nitro uses `event.waitUntil` to keep the instance alive while the cache is being updated while the response is sent to the client.
In a edge workers, the instance is destroyed after each request. Nitro automatically uses `event.waitUntil` to keep the instance alive while the cache is being updated while the response is sent to the client.

To make sure your cached functions are working as expected in a serverless environment, you should always give the `event` as first argument to the function.
To make sure your cached functions are working as expected in a edge workers, you should always give the `event` as first argument to the function with `defineCachedFunction`.

::code-group
```ts [utils/github.ts]
Expand Down

0 comments on commit 00c308c

Please sign in to comment.