# `Charon.Utils.PersistentTermCache`
[🔗](https://github.com/weareyipyip/charon/blob/v4.3.0/lib/charon/utils/persistent_term_cache.ex#L1)

Cache things using `m::persistent_term`. Be careful when using this; `m::persistent_term` is only suitable for very read-heavy storage, to the point the cached item should probably be write-once-read-often.

# `get_or_create`
*since 4.0.0* 

```elixir
@spec get_or_create(term(), (-&gt; term())) :: term()
```

Get the item stored under `key` from `m::persistent_term`. If it does not exist, create it using `create/0` and cache it under `key`.

## Doctests

    iex> create = fn -> "I'm cached" end
    iex> get_or_create(__MODULE__, create)
    "I'm cached"
    iex> create = fn -> "I'm never created" end
    iex> get_or_create(__MODULE__, create)
    "I'm cached"

---

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