more code

This commit is contained in:
developer committed 2026-09-27 11:34:26 +00:00
1 parent f24fd63e9a
commit ee72257c64
29 files changed
+5636 -440

No files matched your search

+6 -2
View File
@@ -18,6 +18,7 @@ package cache
import (
"encoding/binary"
"strings"
"sync/atomic"
"time"
"github.com/miekg/dns"
@@ -160,8 +161,11 @@ type Entry struct {
StaleUntil time.Time
// Bytes is the accounted size, used by the LRU and the size gauges.
Bytes int
// Hits counts serves since it was stored.
Hits uint32
// Hits counts serves since it was stored. It is atomic because an Entry is
// shared by every goroutine that hits the key (the LRU hands out the same
// pointer on purpose, so a hit never copies the message), and the
// counter is bumped outside the shard lock on the hot path.
Hits atomic.Uint32
// Neg marks a cached NXDOMAIN or NODATA answer.
Neg bool
// Truncated records that the upstream answer did not fit in 512 bytes,