diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-12-01 02:04:01 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-12-01 02:04:01 +0300 |
commit | 9edffc543f407a709afd3fae229360b30f6c0d63 (patch) | |
tree | 1a3bd8036982b55be43b7c61ee7d08a3a4d6c799 /internal | |
parent | b0dc301ecb87b7ee3b3fe7680c326a266c930a9c (diff) |
refactor: rename func and const to ensure
make sure we're not spilling implementation details from
the ratelimites package
Diffstat (limited to 'internal')
-rw-r--r-- | internal/lru/lru.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/lru/lru.go b/internal/lru/lru.go index 741d9ad2..8c467ba5 100644 --- a/internal/lru/lru.go +++ b/internal/lru/lru.go @@ -19,8 +19,8 @@ const itemsToPruneDiv = 16 // based on an avg ~4,000 unique IPs per minute // https://log.gprd.gitlab.net/app/lens#/edit/f7110d00-2013-11ec-8c8e-ed83b5469915?_g=h@e78830b -const defaultSourceIPItems = 5000 -const defaultSourceIPExpirationInterval = time.Minute +const defaultCacheMaxSize = 1000 +const defaultCacheExpirationInterval = time.Minute // Option function to configure a Cache type Option func(*Cache) @@ -106,13 +106,13 @@ func WithCachedRequestsMetric(m *prometheus.CounterVec) Option { } } -func WithSourceIPExpirationInterval(t time.Duration) Option { +func WithExpirationInterval(t time.Duration) Option { return func(c *Cache) { c.duration = t } } -func WithSourceIPItems(i int64) Option { +func WithMaxSize(i int64) Option { return func(c *Cache) { c.maxSize = i } |