DNS.Zone.Cache (DNS v0.4.1)
View SourceZone caching system for DNS zones.
Provides in-memory caching for zone data with TTL-based expiration, automatic refresh, and memory management.
Summary
Functions
Clean expired zones from cache.
Clear the entire cache.
Remove a zone from cache.
Get a zone from cache if not expired.
Get cache metadata for a zone.
Initialize the zone cache.
Get all cached zones that are not expired.
Store a zone in cache with TTL.
Refresh a zone from its source if needed.
Get cache statistics.
Check if a zone is cached and not expired.
Functions
@spec cleanup_expired() :: integer()
Clean expired zones from cache.
@spec clear() :: :ok
Clear the entire cache.
@spec delete_zone(String.t() | DNS.Zone.Name.t()) :: :ok
Remove a zone from cache.
@spec get_zone(String.t() | DNS.Zone.Name.t()) :: {:ok, DNS.Zone.t()} | {:error, :not_found | :expired}
Get a zone from cache if not expired.
@spec get_zone_meta(String.t() | DNS.Zone.Name.t()) :: {:ok, map()} | {:error, :not_found}
Get cache metadata for a zone.
@spec init() :: :ok
Initialize the zone cache.
@spec list_zones() :: [{DNS.Zone.t(), map()}]
Get all cached zones that are not expired.
@spec put_zone(DNS.Zone.t(), integer(), keyword()) :: :ok
Store a zone in cache with TTL.
@spec refresh_zone(String.t() | DNS.Zone.Name.t()) :: {:ok, DNS.Zone.t()} | {:error, String.t()}
Refresh a zone from its source if needed.
@spec stats() :: map()
Get cache statistics.
@spec zone_cached?(String.t() | DNS.Zone.Name.t()) :: boolean()
Check if a zone is cached and not expired.