Skip to content

Key value session storage

Mikhail edited this page Jan 10, 2021 · 3 revisions

Key-value session storage

Also, ISession have a built-it thread-safe key-value ISessionStorage which have three modes:

  • Global - one shared storage for each session being used.
  • Per user - one shared storage for each session, which have the same owner (User). E.g. sessions for Message and CallbackQuery entity types, but with the same owner, will have the same storage.
  • Per entity type - one shared storage for each session, which have the same owner (User) and entity type. E.g. both Message and CallbackQuery will have different storage.

Storage could be used for:

  • Adding new entries (ISessionStorage.Add).
  • Retrieving already added entries (ISessionStorage.Get).
  • Checking an entry for existence by the specified key (ISessionStorage.IsExists).
  • Updating already added entries (ISessionStorage.Update).
  • Removing existing entries (ISessionStorage.Remove).