# `ExMCP.Client.EraCache`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/client/era_cache.ex#L1)

Stores protocol-era observations independently of an individual client.

Modern observations do not expire and cannot be replaced by an automatic
legacy fallback. Legacy observations have a bounded lifetime so an upgraded
server will eventually be probed again. Values used to identify HTTP auth
configuration are hashed before they are stored in ETS.

The cache is intentionally process-local. Operators can clear all
observations with `clear/0`, or clear one connection identity by starting a
client with `reset_era_cache: true`.

# `era`

```elixir
@type era() :: :legacy | :modern
```

# `identity`

```elixir
@type identity() :: :none | {:configured | :http | :process, binary()}
```

# `observation`

```elixir
@type observation() :: %{
  era: era(),
  protocol_version: String.t(),
  observed_at: integer(),
  expires_at: integer() | :infinity
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clear`

```elixir
@spec clear() :: :ok
```

Clears all cached protocol-era observations.

# `identity`

```elixir
@spec identity(module(), term(), keyword()) :: identity()
```

Returns the stable cache identity for a connected transport.

# `lookup`

```elixir
@spec lookup(identity()) :: {:ok, observation()} | :miss
```

Looks up a non-expired era observation.

# `observe`

```elixir
@spec observe(identity(), era(), String.t(), keyword()) :: :ok
```

Records a successful protocol-era observation.

# `start_link`

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

---

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