View Source MdnsLite.Cache (mdns_lite v0.8.11)
Cache for records received over mDNS
Summary
Functions
Remove any expired entries
Insert a record into the cache
Insert several record into the cache
Start an empty cache
Run a query against the cache
Types
@type t() :: %MdnsLite.Cache{last_gc: timestamp(), records: [MdnsLite.DNS.dns_rr()]}
@type timestamp() :: integer()
Timestamp in seconds (assumed monotonic)
Functions
Remove any expired entries
@spec insert(t(), timestamp(), MdnsLite.DNS.dns_rr()) :: t()
Insert a record into the cache
@spec insert_many(t(), timestamp(), [MdnsLite.DNS.dns_rr()]) :: t()
Insert several record into the cache
@spec new() :: %MdnsLite.Cache{last_gc: -2_147_483_648, records: []}
Start an empty cache
@spec query(t(), MdnsLite.DNS.dns_query()) :: %{ answer: [MdnsLite.DNS.dns_rr()], additional: [MdnsLite.DNS.dns_rr()] }
Run a query against the cache
IMPORTANT: The cache is not garbage collected, so it can return stale entries.
Call gc/2
first to expire old entries.