Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions site/docs/plugins/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,12 @@ You can then keep using `SessionFlavor<SessionData>` for your context object.

Lazy sessions is an alternative implementation of sessions that can significantly reduce the database traffic of your bot by skipping superfluous read and write operations.

::: warning Lazy sessions do not support multi sessions
Lazy sessions and [multi sessions](#multi-sessions) are mutually exclusive.
`lazySession` is a separate implementation of the session middleware, and it does not accept the `type: "multi"` configuration that the strict `session` middleware does.
If you need several independent session namespaces (for example, one per chat and one per user), use the default strict `session` middleware with `type: "multi"`.
:::
Comment on lines +644 to +648

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This takes up a bit too much space IMO. What do you think of this?

Suggested change
::: warning Lazy sessions do not support multi sessions
Lazy sessions and [multi sessions](#multi-sessions) are mutually exclusive.
`lazySession` is a separate implementation of the session middleware, and it does not accept the `type: "multi"` configuration that the strict `session` middleware does.
If you need several independent session namespaces (for example, one per chat and one per user), use the default strict `session` middleware with `type: "multi"`.
:::
> Note that the lazy session implementation has no concept of multi sessions.
> Stick with the regular session implementation if you want to use its [multi sessions](#multi-sessions).


Let's assume that your bot is in a group chat where it does not respond to regular text messages, but only to commands.
Without sessions, this would happen:

Expand Down