cooldown

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 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 Timer

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

Timer is used to set a cooldown timer on a key.

func NewTimer

func NewTimer(skipCleanup bool, cleanTimer time.Duration) *Timer

NewTimer returns a struct for which you can use Active().

func (*Timer) Active

func (t *Timer) Active(key string, coolFor time.Duration) bool

Active returns true if a cooldown timer is active for a key. If it's not active, it's saved (for next time).

func (*Timer) Running

func (t *Timer) Running() bool

Running returns false if StopTimer has been called; true otherwise.

func (*Timer) Sizes

func (t *Timer) Sizes() (int, int)

Sizes returns the tracked item length and the channel queue length.

func (*Timer) StopTimer

func (t *Timer) StopTimer()

StopTimer kills the active cooler. Do not call Active() after you call this method.

Jump to

Keyboard shortcuts

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