Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion memorystore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ type Config struct {
// memory consumption for performance as it limits the number of times the map
// needs to expand. The default value is 4096.
InitialAlloc int

// DisablePurge disables the purge operation. WARNING: this will cause
// unbounded memory growth. Do not enable unless you have a fixed number of
// buckets.
DisablePurge bool
}

// New creates an in-memory rate limiter that uses a bucketing model to limit
Expand Down Expand Up @@ -102,7 +107,11 @@ func New(c *Config) (limiter.Store, error) {
data: make(map[string]*bucket, initialAlloc),
stopCh: make(chan struct{}),
}
go s.purge()

if !c.DisablePurge {
go s.purge()
}

return s, nil
}

Expand Down
Loading