mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
14
plugin/cache/README.md
vendored
14
plugin/cache/README.md
vendored
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
With *cache* enabled all records except zone transfers and metadata records will be cached for up to
|
With *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,
|
3600s. Caching is mostly useful in a scenario when fetching data from the backend (upstream,
|
||||||
database, etc.) is expensive.
|
database, etc.) is expensive.
|
||||||
|
|
||||||
@@ -16,9 +16,9 @@ database, etc.) is expensive.
|
|||||||
cache [TTL] [ZONES...]
|
cache [TTL] [ZONES...]
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
* **TTL** max TTL in seconds. If not specified, the maximum TTL will be used which is 3600 for
|
* **TTL** max TTL in seconds. If not specified, the maximum TTL will be used, which is 3600 for
|
||||||
noerror responses and 1800 for denial of existence ones.
|
noerror responses and 1800 for denial of existence ones.
|
||||||
Setting a TTL of 300: `cache 300` would cache the record up to 300 seconds.
|
Setting a TTL of 300: `cache 300` would cache records up to 300 seconds.
|
||||||
* **ZONES** zones it should cache for. If empty, the zones from the configuration block are used.
|
* **ZONES** zones it should cache for. If empty, the zones from the configuration block are used.
|
||||||
|
|
||||||
Each element in the cache is cached according to its TTL (with **TTL** as the max).
|
Each element in the cache is cached according to its TTL (with **TTL** as the max).
|
||||||
@@ -36,13 +36,13 @@ cache [TTL] [ZONES...] {
|
|||||||
~~~
|
~~~
|
||||||
|
|
||||||
* **TTL** and **ZONES** as above.
|
* **TTL** and **ZONES** as above.
|
||||||
* `success`, override the settings for caching successful responses, **CAPACITY** indicates the maximum
|
* `success`, override the settings for caching successful responses. **CAPACITY** indicates the maximum
|
||||||
number of packets we cache before we start evicting (*randomly*). **TTL** overrides the cache maximum TTL.
|
number of packets we cache before we start evicting (*randomly*). **TTL** overrides the cache maximum TTL.
|
||||||
* `denial`, override the settings for caching denial of existence responses, **CAPACITY** indicates the maximum
|
* `denial`, override the settings for caching denial of existence responses. **CAPACITY** indicates the maximum
|
||||||
number of packets we cache before we start evicting (LRU). **TTL** overrides the cache maximum TTL.
|
number of packets we cache before we start evicting (LRU). **TTL** overrides the cache maximum TTL.
|
||||||
There is a third category (`error`) but those responses are never cached.
|
There is a third category (`error`) but those responses are never cached.
|
||||||
* `prefetch`, will prefetch popular items when they are about to be expunged from the cache.
|
* `prefetch` will prefetch popular items when they are about to be expunged from the cache.
|
||||||
Popular means **AMOUNT** queries have been seen no gaps of **DURATION** or more between them.
|
Popular means **AMOUNT** queries have been seen with no gaps of **DURATION** or more between them.
|
||||||
**DURATION** defaults to 1m. Prefetching will happen when the TTL drops below **PERCENTAGE**,
|
**DURATION** defaults to 1m. Prefetching will happen when the TTL drops below **PERCENTAGE**,
|
||||||
which defaults to `10%`. Values should be in the range `[10%, 90%]`. Note the percent sign is
|
which defaults to `10%`. Values should be in the range `[10%, 90%]`. Note the percent sign is
|
||||||
mandatory. **PERCENTAGE** is treated as an `int`.
|
mandatory. **PERCENTAGE** is treated as an `int`.
|
||||||
|
|||||||
Reference in New Issue
Block a user