counter

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter interface {
	Add(int64)
	Reset()
	Value() int64
}

Counter is a counter interface.

type Group

type Group struct {

	// New optionally specifies a function to generate a counter.
	// It may not be changed concurrently with calls to other functions.
	New func() Counter
	// contains filtered or unexported fields
}

Group is a counter group.

func (*Group) Add

func (g *Group) Add(key string, value int64)

Add add a counter by a specified key, if counter not exists then make a new one and return new value.

func (*Group) Reset

func (g *Group) Reset(key string)

Reset reset a counter by key.

func (*Group) Value

func (g *Group) Value(key string) int64

Value get a counter value by key.

Jump to

Keyboard shortcuts

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