# `EMLX.CompileCache`
[🔗](https://github.com/elixir-nx/emlx/blob/v0.4.2/emlx/lib/emlx/compile_cache.ex#L1)

Bounded cache of `native_compile/3` eval closures.

`EMLX.__compile__/4` stores one closure per `{fun, templates, hooks, device}`
so repeated `Nx.Defn.jit/2` of the same call site skips retrace. Unbounded
unless the host sets:

    config :emlx, EMLX.CompileCache,
      max_items: 1024,
      ttl: :timer.minutes(30)

Both default to `:infinity`. Overflow is FIFO by insert index. TTL is from
insert time and is swept by this process (`send_after(self(), :expire_entries,
div(ttl, 2))`), not on cache reads. A sweeper that is already running re-reads
app env each tick; if TTL is `:infinity` at start, nothing is scheduled until
the process restarts.

The structural program table `:emlx_native_dispatch_cache` is shared across
call sites and is not bounded by these knobs.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

---

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