Charon.Utils.PersistentTermCache (Charon v4.2.0)
View SourceCache things using :persistent_term. Be careful when using this; :persistent_term is only suitable for very read-heavy storage, to the point the cached item should probably be write-once-read-often.
Summary
Functions
Get the item stored under key from :persistent_term. If it does not exist, create it using create/0 and cache it under key.
Functions
Get the item stored under key from :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"