Cache for the results of Tezex.Rpc.entrypoints/2 and Tezex.Rpc.entrypoint/3.
The process only owns a named public ETS table. Callers read and write the table directly, so lookups never go through the process.
Keys:
{endpoint, chain_id, address}for the entrypoint list of a contract{endpoint, chain_id, address, name}for the type of one entrypoint
The endpoint is part of the key so that two networks never share entries.
A contract's code can't change once it is deployed, so entries never expire.
Only {:ok, _} results are stored. Once the table uses 32 MiB, storing one
more entry empties it first.
Summary
Functions
Returns a specification to start this module under a supervisor.
Remove every entry.
Return the cached value for key as {:ok, value}. On a miss, call fun,
store its result if it is {:ok, value}, and return it.
Return {:ok, value} if key is cached, :error otherwise.
Store value under key.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Remove every entry.
@spec fetch(key(), (-> {:ok, value} | {:error, reason})) :: {:ok, value} | {:error, reason} when value: term(), reason: term()
Return the cached value for key as {:ok, value}. On a miss, call fun,
store its result if it is {:ok, value}, and return it.
Return {:ok, value} if key is cached, :error otherwise.
Store value under key.