erldns_packet_cache (erldns v6.0.2)

View Source

A basic packet cache that is used to avoid multiple lookups for the same question received within the cache TTL.

The cache is swept for old cache data at regular intervals.

Emits the following telemetry events:

  • [erldns, cache, expired]
  • [erldns, cache, miss]
  • [erldns, cache, hit]

Summary

Types

state()

-opaque state()

Functions

clear()

-spec clear() -> any().

code_change(PreviousVersion, State, Extra)

get(Key)

-spec get(dns:question() | {dns:question(), [dns:rr()]}) ->
             {ok, dns:message()} | {error, cache_expired} | {error, cache_miss}.

get(Key, Host)

-spec get(dns:question() | {dns:question(), [dns:rr()]}, dns:ip()) ->
             {ok, dns:message()} | {error, cache_expired} | {error, cache_miss}.

handle_call/3

handle_cast/2

handle_info(Message, State)

init/1

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

put(Key, Response)

-spec put(dns:question() | {dns:question(), [dns:rr()]}, dns:message()) -> ok.

start_link()

-spec start_link() -> any().

stop()

-spec stop() -> any().

sweep()

-spec sweep() -> any().

terminate(Reason, State)