lazydns

Cache Plugin

The cache plugin stores DNS responses to reduce upstream traffic and improve latency. It supports TTL-respecting caching, negative caching, LRU eviction, LazyCache background refresh, stale-serving, and persistence across restarts.

Key features

Configuration options

Persistence

When dump_file is set, the cache is saved to a binary file on shutdown and periodically (every dump_interval seconds, or after 1024 writes). On startup, the file is loaded and entries that have not yet expired are restored. Entries are stored in DNS wire format with their original TTL and cache timestamp.

Example

plugins:
  - tag: my_cache
    type: cache
    args:
      size: 2048
      negative_cache: true
      negative_ttl: 300
      enable_lazycache: true
      lazycache_threshold: 0.05
      cache_ttl: 600
      dump_file: /var/lib/lazydns/cache.dump
      dump_interval: 300

Metrics