Module storage

Module storage 

Source
Expand description

Storage implementations for sessions

This module provides various storage backends for session data, with optional support for session indexing by identifier.

§Session Indexing

Some storage backends support indexing sessions by an identifier (like user ID). This enables advanced features such as:

  • Finding all active sessions for a user
  • Bulk invalidation of sessions (e.g., “log out everywhere”)
  • Security auditing and monitoring

To use indexing, your session type must implement crate::SessionIdentifier.

§Custom Storage

Implement SessionStorage to create custom storage backends. For indexing support, also implement SessionStorageIndexed.

Modules§

cookiecookie
Cookie-based session storage implementation
memory
In-memory session storage implementation
redisredis_fred
Session storage with Redis (and Redis-compatible databases)
sqlxsqlx_postgres or sqlx_sqlite
Session storage via sqlx

Traits§

SessionStorage
Trait representing a session backend storage. You can use your own session storage by implementing this trait.
SessionStorageIndexed
Extended trait for storage backends that support session indexing by identifier. This allows operations like finding all sessions for a user or bulk invalidation.