diff --git a/cache.go b/cache.go index 16dbc1c2..2cfd88d4 100644 --- a/cache.go +++ b/cache.go @@ -49,3 +49,16 @@ type clientCache struct { operations uint64 } +func newClientCache(cfg *compiledConfig) *clientCache { + return &clientCache{ + entries: make(map[string]*clientState), + maxEntries: cfg.MaxTrackedIPs, + maxEvents: cfg.MaxScoreEventsPerIP, + scoreWindow: cfg.scoreWindow, + banDuration: cfg.banDuration, + threshold: cfg.ScoreThreshold, + randomPaths: append([]string(nil), cfg.randomPaths...), + randomScore: cfg.RandomArticleScore, + } +} +