|
NAMEcache - enables a frontend cache.DESCRIPTIONWith cache enabled, all records except zone transfers and metadata records will be cached for up to 3600s. Caching is mostly useful in a scenario when fetching data from the backend (upstream, database, etc.) is expensive.Cache will change the query to enable DNSSEC (DNSSEC OK; DO) if it passes through the plugin. If the client didn't request any DNSSEC (records), these are filtered out when replying. This plugin can only be used once per Server Block. SYNTAXcache [TTL] [ZONES...]
Each element in the cache is cached according to its TTL (with TTL as the max). A cache is divided into 256 shards, each holding up to 39 items by default - for a total size of 256 * 39 = 9984 items. If you want more control: cache [TTL] [ZONES...] { success CAPACITY [TTL] [MINTTL] denial CAPACITY [TTL] [MINTTL] prefetch AMOUNT [[DURATION] [PERCENTAGE%]] serve_stale [DURATION] }
CAPACITY AND EVICTIONIf CAPACITY is not specified, the default cache size is 9984 per cache. The minimum allowed cache size is 1024. If CAPACITY is specified, the actual cache size used will be rounded down to the nearest number divisible by 256 (so all shards are equal in size).Eviction is done per shard. In effect, when a shard reaches capacity, items are evicted from that shard. Since shards don't fill up perfectly evenly, evictions will occur before the entire cache reaches full capacity. Each shard capacity is equal to the total cache size / number of shards (256). Eviction is random, not TTL based. Entries with 0 TTL will remain in the cache until randomly evicted when the shard reaches capacity. METRICSIf monitoring is enabled (via the prometheus plugin) then the following metrics are exported:
Cache types are either "denial" or "success". Server is the server handling the request, see the prometheus plugin for documentation. EXAMPLESEnable caching for all zones, but cap everything to a TTL of 10 seconds:. { cache 10 whoami } Proxy to Google Public DNS and only cache responses for example.org (or below). . { forward . 8.8.8.8:53 cache example.org } Enable caching for example.org, keep a positive cache size of 5000 and a negative cache size of 2500: example.org { cache { success 5000 denial 2500 } }
Visit the GSP FreeBSD Man Page Interface. |