erldns_packet_cache (erldns v6.0.1)
View SourceA 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
Functions
-spec clear() -> any().
-spec get(dns:question() | {dns:question(), [dns:rr()]}) -> {ok, dns:message()} | {error, cache_expired} | {error, cache_miss}.
-spec get(dns:question() | {dns:question(), [dns:rr()]}, dns:ip()) -> {ok, dns:message()} | {error, cache_expired} | {error, cache_miss}.
-spec init([non_neg_integer()]) -> {ok, state()}.
-spec put(dns:question() | {dns:question(), [dns:rr()]}, dns:message()) -> ok.
-spec start_link() -> any().
-spec stop() -> any().
-spec sweep() -> any().