feat: cache warming for configured domains #78

Merged
razvandimescu merged 1 commits from feat/cache-warming into main 2026-04-11 06:14:05 +08:00
razvandimescu commented 2026-04-11 06:00:18 +08:00 (Migrated from github.com)

Summary

  • New [cache] warm config field: list domains to keep hot in cache
  • Resolves A + AAAA at startup, re-resolves proactively before TTL expiry (at 75% elapsed)
  • DnsCache::ttl_remaining() and needs_warm() methods for threshold checks
  • Banner row shows warm domain count at startup
  • 5 new tests (200 total): TTL remaining, needs_warm logic
[cache]
warm = ["google.com", "github.com"]

Closes #34 (item 4)

Test plan

  • make all passes (200 tests, clippy, fmt, audit)
  • needs_warm returns true for missing domains
  • needs_warm returns false for freshly cached A + AAAA
  • needs_warm returns true when only one record type is cached
  • ttl_remaining returns correct values for cached entries
  • ttl_remaining returns None for missing entries
  • Manual: startup log shows "cache warm: 2 domains resolved at startup"

🤖 Generated with Claude Code

## Summary - New `[cache] warm` config field: list domains to keep hot in cache - Resolves A + AAAA at startup, re-resolves proactively before TTL expiry (at 75% elapsed) - `DnsCache::ttl_remaining()` and `needs_warm()` methods for threshold checks - Banner row shows warm domain count at startup - 5 new tests (200 total): TTL remaining, needs_warm logic ```toml [cache] warm = ["google.com", "github.com"] ``` Closes #34 (item 4) ## Test plan - [x] `make all` passes (200 tests, clippy, fmt, audit) - [x] `needs_warm` returns true for missing domains - [x] `needs_warm` returns false for freshly cached A + AAAA - [x] `needs_warm` returns true when only one record type is cached - [x] `ttl_remaining` returns correct values for cached entries - [x] `ttl_remaining` returns None for missing entries - [x] Manual: startup log shows "cache warm: 2 domains resolved at startup" 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.