View Source cure_instance_registry (cure v0.7.0)
Summary
Types
-type instance_entry() :: #instance_entry{typeclass :: atom(), type_key :: term(), methods :: #{atom() => compiled_method()}, priority :: integer(), registered_at :: erlang:timestamp()}.
-type type_key() :: term().
-type typeclass() :: atom().
Functions
-spec clear_cache() -> ok.
-spec get_all_instances(typeclass()) -> [instance_entry()].
-spec get_method(typeclass(), atom(), term()) -> {ok, compiled_method()} | {error, term()}.
-spec lookup_instance(typeclass(), term()) -> {ok, instance_entry()} | not_found.
-spec register_instance(typeclass(), term(), #{atom() => compiled_method()}) -> ok | {error, term()}.
-spec stop() -> ok.