# `Oidcc.Plug.Cache`
[🔗](https://github.com/erlef/oidcc_plug/blob/989b809174070ef71c9dc545de149854f86d8f7c
/lib/oidcc/plug/cache.ex#L1)

Behaviour to cache introspection / userinfo requests

## Usage

* Userinfo: See `t:Oidcc.Plug.LoadUserinfo.opts/0` / `cache`
* Introspection: See `t:Oidcc.Plug.IntrospectToken.opts/0` / `cache`

# `t`
*since 0.1.0* 

```elixir
@type t() :: module()
```

# `get`
*since 0.1.0* 

```elixir
@callback get(type :: :userinfo, token :: String.t(), conn :: Plug.Conn.t()) ::
  {:ok, :oidcc_jwt_util.claims()} | :miss
@callback get(type :: :introspection, token :: String.t(), conn :: Plug.Conn.t()) ::
  {:ok, Oidcc.TokenIntrospection.t()} | :miss
```

Check cache if userinfo / introspection is stored for `token`.

# `put`
*since 0.1.0* 

```elixir
@callback put(
  type :: :userinfo,
  token :: String.t(),
  data :: :oidcc_jwt_util.claims(),
  conn :: Plug.Conn.t()
) :: :ok
@callback put(
  type :: :introspection,
  token :: String.t(),
  data :: Oidcc.TokenIntrospection.t(),
  conn :: Plug.Conn.t()
) :: :ok
```

Store userinfo / introspection for `token`.

---

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