MCPcopy
hub / github.com/coredns/coredns / periodicClean

Function periodicClean

plugin/dnssec/cache.go:26–48  ·  view source on GitHub ↗
(c *cache.Cache[[]dns.RR], stop <-chan struct{})

Source from the content-addressed store, hash-verified

24}
25
26func periodicClean(c *cache.Cache[[]dns.RR], stop <-chan struct{}) {
27 tick := time.NewTicker(8 * time.Hour)
28 defer tick.Stop()
29 for {
30 select {
31 case <-tick.C:
32 // we sign for 8 days, check if a signature in the cache reached 75% of that (i.e. 6), if found delete
33 // the signature
34 is75 := time.Now().UTC().Add(twoDays)
35 c.Walk(func(items map[uint64][]dns.RR, key uint64) bool {
36 for _, rr := range items[key] {
37 if !rr.(*dns.RRSIG).ValidityPeriod(is75) {
38 delete(items, key)
39 }
40 }
41 return true
42 })
43
44 case <-stop:
45 return
46 }
47 }
48}

Callers 1

setupFunction · 0.85

Calls 4

StopMethod · 0.65
deleteFunction · 0.50
AddMethod · 0.45
WalkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…