kura_query_cache (kura v2.0.6)

View Source

ETS-based cache for compiled query results.

Caches {SQL, Params} tuples keyed by {RepoMod, QueryHash} so two repos with different dialects don't share entries. Identical queries through the same repo skip recompilation.

The ETS table is owned by kura_query_cache_owner (a gen_server under kura_sup), so the table survives any caller exiting.

Summary

Functions

Look up a cached compiled query by key.

Initialize the query cache ETS table. No-op when the cache owner is already running (the normal app-startup path). Used by tests that exercise the cache without starting the kura app.

Store a compiled query result for a key.

Functions

get(Key)

-spec get(term()) -> {ok, {iodata(), [term()]}} | miss.

Look up a cached compiled query by key.

handle_call(Req, From, State)

handle_cast(Msg, State)

init()

-spec init() -> ok.

Initialize the query cache ETS table. No-op when the cache owner is already running (the normal app-startup path). Used by tests that exercise the cache without starting the kura app.

init/1

-spec init([]) -> {ok, []}.

put(Key, Result)

-spec put(term(), {iodata(), [term()]}) -> ok.

Store a compiled query result for a key.

start_link()

-spec start_link() -> gen_server:start_ret().