Documentation
¶
Overview ¶
Package rate provides an in-memory sliding window counter store for Keep's rateCount() CEL function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a thread-safe sliding window counter store.
func NewStoreWithClock ¶
NewStoreWithClock creates a store with a custom clock for testing.
func (*Store) GC ¶
GC removes entries older than maxAge from all keys. Removes keys that become empty.
func (*Store) Increment ¶
Increment records a hit for the given key at the current time. If the store has reached maxKeys and the key is new, the increment is skipped. If a key has reached maxTimestampsPerKey, the oldest entries are trimmed.
Click to show internal directories.
Click to hide internal directories.