Metastatic. Cache behaviour
(Metastatic v0.33.0)
View Source
AST Caching behaviour and dispatcher for Metastatic.
Caches the results of parsing and abstracting source code to MetaAST (M2).
Backends
The backend is selected with config :metastatic, :cache, backend:
:ets(default) —Metastatic.Cache.ETS, in-memory, always available.:dllb—Metastatic.Cache.DLLB, opt-in; requires the host application to provide theDllbmodule and setconfig :dllb, :enabled, true.- any module implementing the
Metastatic.Cachebehaviour.
The default is deliberately :ets rather than environment sniffing: a
library should not silently change behaviour based on what happens to be
loaded in the host VM.
Summary
Functions
Clear all cached entries from the active cache backend.
Get cached abstraction result (MetaAST + Metadata) for a source code string and language.
Return the configured cache implementation module.
Initialize the active cache backend. Called automatically during application startup.
Store abstraction result in cache.
Callbacks
@callback clear() :: :ok
@callback init() :: :ok
Functions
@spec clear() :: :ok
Clear all cached entries from the active cache backend.
Get cached abstraction result (MetaAST + Metadata) for a source code string and language.
@spec impl() :: module()
Return the configured cache implementation module.
Options for :metastatic, :cache are:
:ets(default) ->Metastatic.Cache.ETS:dllb->Metastatic.Cache.DLLB- A module implementing
Metastatic.Cache
@spec init() :: :ok
Initialize the active cache backend. Called automatically during application startup.
Store abstraction result in cache.