Redis.PlugSession (Redis v0.7.1)

Copy Markdown View Source

A Plug.Session.Store backed by Redis.

Stores session data as serialized terms in Redis with configurable TTL. Each session gets a unique key prefixed with a configurable namespace.

Usage

In your Phoenix endpoint or Plug pipeline:

plug Plug.Session,
  store: Redis.PlugSession,
  key: "_my_app_session",
  table: :redis,
  signing_salt: "your_salt",
  ttl: 86_400

Options

  • :table (required) - Redis connection name or pid
  • :prefix - key prefix (default: "plug:session:")
  • :ttl - session TTL in seconds (default: 86400 / 24 hours)

The :table option is named for compatibility with Plug.Session's option naming convention. It should be a Redis.Connection pid or registered name.