{
  "id": "session-store",
  "title": "Redis session store",
  "url": "https://redis.io/docs/latest/develop/use-cases/session-store/",
  "summary": "Store web sessions in Redis with cookie-based session IDs and TTL expiration",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc"
  ],
  "last_updated": "2026-04-16T13:29:55-07:00",
  "children": [
    {
      "id": "redis-py",
      "summary": "Implement a Redis-backed session store in Python with redis-py",
      "title": "Redis session store with redis-py",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/redis-py/"
    },
    {
      "id": "nodejs",
      "summary": "Implement a Redis-backed session store in Node.js with node-redis",
      "title": "Redis session store with node-redis",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/nodejs/"
    },
    {
      "id": "go",
      "summary": "Implement a Redis-backed session store in Go with go-redis",
      "title": "Redis session store with Go",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/go/"
    },
    {
      "id": "java-jedis",
      "summary": "Implement a Redis-backed session store in Java with Jedis",
      "title": "Redis session store with Java and Jedis",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/java-jedis/"
    },
    {
      "id": "dotnet",
      "summary": "Implement a Redis-backed session store in .NET with StackExchange.Redis",
      "title": "Redis session store with .NET",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/dotnet/"
    },
    {
      "id": "java-lettuce",
      "summary": "Implement a Redis-backed session store in Java with Lettuce",
      "title": "Redis session store with Java (Lettuce)",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/java-lettuce/"
    },
    {
      "id": "php",
      "summary": "Implement a Redis-backed session store in PHP with Predis",
      "title": "Redis session store with PHP",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/php/"
    },
    {
      "id": "ruby",
      "summary": "Implement a Redis-backed session store in Ruby with redis-rb",
      "title": "Redis session store with Ruby",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/ruby/"
    },
    {
      "id": "rust",
      "summary": "Implement a Redis-backed session store in Rust with redis-rs",
      "title": "Redis session store with Rust",
      "url": "https://redis.io/docs/latest/develop/use-cases/session-store/rust/"
    }
  ],
  "page_type": "content",
  "content_hash": "93dbbce53b5e09b9c96f330d975f3df0d5391b690d473150100df64569a2b719",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "This guide family shows how to store web sessions in Redis so multiple application servers can share session state."
    },
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "A Redis-backed session store is a good fit when you need:\n\n* Shared session state across multiple web servers\n* Fast reads and writes for authenticated user state\n* Automatic session expiration after inactivity\n* A simple way to store lightweight user-specific data\n\nThe typical pattern is:\n\n1. Generate an opaque session ID\n2. Store the session data in Redis under a key such as `session:{id}`\n3. Send the session ID to the browser in a cookie\n4. Load the session from Redis on each request\n5. Refresh the TTL while the session stays active"
    },
    {
      "id": "available-implementations",
      "title": "Available implementations",
      "role": "content",
      "text": "* [redis-py](https://redis.io/docs/latest/develop/use-cases/session-store/redis-py) - Build a Python session store and a local demo server using the standard library HTTP server\n* [Node.js](https://redis.io/docs/latest/develop/use-cases/session-store/nodejs) - Build a Redis-backed session store with `node-redis` and a local Node.js demo server\n* [Go](https://redis.io/docs/latest/develop/use-cases/session-store/go) - Build a Redis-backed session store with `go-redis` and a local Go demo server\n* [Java](https://redis.io/docs/latest/develop/use-cases/session-store/java-jedis) - Build a Redis-backed session store with Jedis and a local Java demo server\n* [Java (Lettuce)](https://redis.io/docs/latest/develop/use-cases/session-store/java-lettuce) - Build a Redis-backed session store with Lettuce using async and reactive APIs\n* [.NET](https://redis.io/docs/latest/develop/use-cases/session-store/dotnet) - Build a Redis-backed session store with `StackExchange.Redis` and a local ASP.NET Core demo server\n* [PHP](https://redis.io/docs/latest/develop/use-cases/session-store/php) - Build a Redis-backed session store with Predis and a local PHP demo server\n* [Ruby](https://redis.io/docs/latest/develop/use-cases/session-store/ruby) - Build a Redis-backed session store with `redis-rb` and a local Ruby demo server\n* [Rust](https://redis.io/docs/latest/develop/use-cases/session-store/rust) - Build a Redis-backed session store with `redis-rs`, including both sync and async APIs"
    }
  ],
  "examples": []
}
