Commit 684c35d5 authored by Chris O'Haver's avatar Chris O'Haver Committed by Miek Gieben

lower cache min limit (#2065)

parent a2175547
......@@ -52,11 +52,12 @@ cache [TTL] [ZONES...] {
## Capacity and Eviction
When specifying **CAPACITY**, the minimum cache capacity is 131,072. Specifying a lower value will be
ignored. Specifying a **CAPACITY** of zero does not disable the cache.
Eviction is done per shard - i.e. 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).
If **CAPACITY** is not specified, the default cache size is 10,000 per cache. The minimum allowed cache size is 1024.
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.
## Metrics
......@@ -89,3 +90,13 @@ Proxy to Google Public DNS and only cache responses for example.org (or below).
cache example.org
}
~~~
Enable caching for all zones, keep a positive cache size of 5000 and a negative cache size of 2500:
~~~ corefile
. {
cache {
success 5000
denial 2500
}
}
~~~
\ No newline at end of file
......@@ -31,8 +31,8 @@ type shard struct {
// New returns a new cache.
func New(size int) *Cache {
ssize := size / shardSize
if ssize < 512 {
ssize = 512
if ssize < 4 {
ssize = 4
}
c := &Cache{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment