refactor(cache): modernize with generics (#7842)

This commit is contained in:
vflaux
2026-02-04 02:23:53 +01:00
committed by GitHub
parent 923a8b5d2b
commit 30c20b52ff
13 changed files with 70 additions and 68 deletions

View File

@@ -24,12 +24,12 @@ type Cache struct {
zonesMetricLabel string
viewMetricLabel string
ncache *cache.Cache
ncache *cache.Cache[*item]
ncap int
nttl time.Duration
minnttl time.Duration
pcache *cache.Cache
pcache *cache.Cache[*item]
pcap int
pttl time.Duration
minpttl time.Duration
@@ -61,11 +61,11 @@ func New() *Cache {
return &Cache{
Zones: []string{"."},
pcap: defaultCap,
pcache: cache.New(defaultCap),
pcache: cache.New[*item](defaultCap),
pttl: maxTTL,
minpttl: minTTL,
ncap: defaultCap,
ncache: cache.New(defaultCap),
ncache: cache.New[*item](defaultCap),
nttl: maxNTTL,
minnttl: minNTTL,
failttl: minNTTL,