counter

package
v0.0.0-...-70692ee Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 9 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 struct {
	// contains filtered or unexported fields
}

func New

func New(rclient *redis.Client, que *jobque.JobQueue, limit int, limitDuration time.Duration) (*Counter, error)

func (*Counter) Call

func (c *Counter) Call(callback func()) (bool, error)

Calls the callback if the counter value less than the limit

func (*Counter) IsReached

func (c *Counter) IsReached() bool

func (*Counter) ResetLoop

func (c *Counter) ResetLoop(errch chan error)

func (*Counter) WaitUnlock

func (c *Counter) WaitUnlock() (ret error)

Jump to

Keyboard shortcuts

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