# `PhoenixReplay.Storage.Retention`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/storage/retention.ex#L1)

Deletes stored recordings beyond the configured age or count.

Runs every `retention.interval` milliseconds when `:max_age` or
`:max_count` is configured; otherwise the process stays idle. Recordings
still in the buffer are never pruned.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `expired`

```elixir
@spec expired(
  [PhoenixReplay.Recording.Summary.t()],
  PhoenixReplay.Config.retention(),
  integer()
) :: [
  PhoenixReplay.Recording.Summary.t()
]
```

Selects summaries older than `max_age` or beyond the newest `max_count`.

`summaries` must be ordered most recent first.

# `prune`

```elixir
@spec prune(PhoenixReplay.Config.t(), integer()) :: [PhoenixReplay.Recording.id()]
```

Deletes every stored recording that `expired/3` selects. Returns the deleted ids.

# `start_link`

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

Starts the retention process registered under its module name.

---

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