# `SferaDoc.Store.Redis`
[🔗](https://github.com/sfera-lab/sfera-doc/blob/v0.1.0/lib/sfera_doc/store/redis.ex#L1)

Redis-backed storage adapter for SferaDoc.

Uses `Redix` for communication. Starts and owns its own Redis connection
within the SferaDoc supervision tree.

## Configuration

    config :sfera_doc, :store,
      adapter: SferaDoc.Store.Redis

    # Redis connection options (host/port or URI)
    config :sfera_doc, :redis,
      host: "localhost",
      port: 6379

    # Or with a URI:
    config :sfera_doc, :redis, "redis://localhost:6379"

## Key Schema

Templates are stored under the following Redis keys:

- `sfera_doc:template:{name}:version:{n}`: JSON of the full template
- `sfera_doc:template:{name}:active`: active version number (string)
- `sfera_doc:template:{name}:versions`: sorted set of all version numbers

All template names are tracked in `sfera_doc:names` (a Redis set).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
