Skip to content
Documentation
Session Adapter

Session Adapter

The Session Adapter is a robust and flexible tool designed to handle session management in your applications. It offers both in-memory and file-based storage options, with additional features like session expiry, session pruning, and session regeneration to prevent fixation attacks. This adapter is also equipped with middleware integration for Express and Next.js, making it a versatile choice for various web development needs.

Features

  • Session Storage: Supports both in-memory and file-based storage.
  • Session Expiry: Manages session expiry and automatic pruning of expired sessions.
  • Session Regeneration: Prevents session fixation attacks by regenerating session IDs.
  • Middleware Integration: Easily integrates with Express and Next.js.
  • Custom Event Hooks: Allows custom logic through event hooks.
  • Development Logs: Optional logging for development and debugging purposes.

Functions

The Session Adapter includes the following functions:

  • load: Loads a session by ID.
  • add: Adds or updates a session.
  • drop: Drops a session by ID.
  • clear: Clears all sessions.
  • stats: Retrieves statistics about the session store.
  • invalidate: Invalidates sessions based on a predicate function.
  • regenerateSessionId: Regenerates a session ID to prevent fixation attacks.
  • expressMiddleware: Integrates with Express middleware.
  • nextMiddleware: Integrates with Next.js middleware.
  • triggerEvent: Provides hooks for custom logic.

Functions:


VERSE.DB. Powered by JEDI Studio.