warner

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 3 Imported by: 3

README

count-warner

Build Status

Count warner, when the count greater than limit, it will emit a warn event

API

w := warner.NewWarner(time.Second, 10)
w.ResetOnWarn = true
w.On(func(key string, count int) {
  fmt.Println(key)
})
w.Inc("abcd", 1)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWarner

func NewWarner(duration time.Duration, max int) *warner

NewWarner returns a new warner

Types

type Count

type Count struct {
	// contains filtered or unexported fields
}

Count count

type Listener

type Listener func(key string, count int)

Listener warner listener

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL