# `Sycophant.Auth.GithubCopilot.TokenCache`

Supervised GenServer that caches Copilot tokens per `{github_host, sha256(gh_token)}`.

- Lazily refreshes on `fetch/2` when within 30s of `expires_at`.
- Serializes concurrent refreshes per cache key (no thundering herd).
- 32-entry LRU keeps memory bounded.
- State has a custom `Inspect` impl that redacts `copilot_token`.

Public API: `fetch/2`. All other functions are GenServer internals.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `fetch`

```elixir
@spec fetch(String.t(), String.t()) ::
  {:ok, Sycophant.Auth.GithubCopilot.TokenCache.Entry.t()}
  | {:error, Splode.Error.t()}
```

Returns a valid Copilot token entry for the given GitHub credential.

Blocks until either a cached entry is available or a fresh exchange completes.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the token cache. Called by Sycophant.Application.

---

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