Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: improve AsyncLocalStorage introduction #36946

Closed
wants to merge 6 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/async_hooks.md
Expand Up @@ -973,6 +973,10 @@ chains. It allows storing data throughout the lifetime of a web request
or any other asynchronous duration. It is similar to thread-local storage
in other languages.

While you can implement your own implementation on top of the `async_hooks`
puzpuzpuz marked this conversation as resolved.
Show resolved Hide resolved
module, `AsyncLocalStorage` is a performant and memory safe implementation that
puzpuzpuz marked this conversation as resolved.
Show resolved Hide resolved
involves non-obvious optimizations.

The following example uses `AsyncLocalStorage` to build a simple logger
that assigns IDs to incoming HTTP requests and includes them in messages
logged within each request.
Expand Down