# `Macaw.Data.Derived.Sandbox.Cache`
[🔗](https://github.com/dcoai/macaw_data/blob/v0.5.3/lib/macaw/data/derived/sandbox/cache.ex#L1)

Compiled functions by source (spec/02 §6.3, visualize D-194): a **value**, held by whatever owns
the functions (the engine, a builder), not a process or a table, as the schema
cache is (spec/01 §1.12).

An entry is keyed by the SHA-256 of the source, the arities and the fields it was checked
against, and the digest of the registry its `Macaw.Data.Ops` calls were checked and
compiled against (spec/04 §6.1), and holds the compilation's answer, a refusal included,
so a source is checked and compiled once. A compilation the runner cut short
(`:reductions`, `:hung`, `:memory`) is not kept, since it says nothing about the source.
The cache never evicts.

# `t`

```elixir
@type t() :: %Macaw.Data.Derived.Sandbox.Cache{entries: map()}
```

# `compile`

```elixir
@spec compile(t(), String.t(), keyword()) ::
  {:ok, Macaw.Data.Derived.Sandbox.Compiled.t(), t()}
  | {:error, [Macaw.Data.Derived.Sandbox.fault(), ...], t()}
```

`compile(cache, source, opts)`: `{:ok, compiled, cache}` or `{:error, faults, cache}`,
as `Macaw.Data.Derived.Sandbox.compile/2` answers, compiled at most once per
source, arities and fields.

# `new`

```elixir
@spec new() :: t()
```

The empty cache.

---

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