spectra_module_types (spectra v0.13.1)

View Source

Summary

Functions

Removes the persistent cache entry for Module.

Removes all local (process-dictionary) cache entries for the calling process.

Resolves type information for Module using the cache mode from Config.

Functions

clear(Module)

-spec clear(Module :: module()) -> ok.

Removes the persistent cache entry for Module.

clear_local()

-spec clear_local() -> ok.

Removes all local (process-dictionary) cache entries for the calling process.

get(Module, Config)

-spec get(Module :: module(), Config :: spectra:sp_config()) -> spectra:type_info().

Resolves type information for Module using the cache mode from Config.

When Config#sp_config.module_types_cache is persistent the result is cached in persistent_term and returned on subsequent calls without re-extracting the abstract code.

When the cache mode is local the result is cached in the process dictionary under a single key {spectra_module_types, local_cache} which holds a map of #{module() => type_info()}. The caller is responsible for clearing the cache via clear_local/0 when the top-level operation completes.

When the cache mode is none type information is always re-extracted.