MdnsLite.Cache (mdns_lite v0.8.0) View Source
Cache for records received over mDNS
Link to this section 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
Link to this section Types
Specs
t() :: %MdnsLite.Cache{last_gc: timestamp(), records: [MdnsLite.DNS.dns_rr()]}
Specs
timestamp() :: integer()
Timestamp in seconds (assumed monotonic)
Link to this section Functions
Specs
Remove any expired entries
Specs
insert(t(), timestamp(), MdnsLite.DNS.dns_rr()) :: t()
Insert a record into the cache
Specs
insert_many(t(), timestamp(), [MdnsLite.DNS.dns_rr()]) :: t()
Insert several record into the cache
Specs
new() :: t()
Start an empty cache
Specs
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.