# `Daraja.Supervisor`
[🔗](https://github.com/okothkongo/daraja/blob/v0.1.1/lib/daraja/supervisor.ex#L1)

Optional supervisor that starts `Daraja.TokenCache`. Add it to your
application's supervision tree to enable token caching across all API calls:

    children = [
      {Daraja.Supervisor, []}
    ]

The library is process-free by default; caching is opt-in.

## Custom names (umbrella apps)

Use `name:` to name the supervisor and `cache_name:` to name the cache
process and its ETS table. They must be distinct atoms:

    {Daraja.Supervisor, name: :billing_sup, cache_name: :billing_cache}

Then point `Daraja.Auth.get_token/1` at the custom cache via config:

    # config/config.exs (or the appropriate umbrella child config)
    config :daraja, token_cache: :billing_cache

Each BEAM node can only register one ETS named table per atom. Starting two
supervisors with the same `cache_name:` (or both using the default) will
fail at startup.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `init`

# `start_link`

---

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