cache

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RATE_LIMITE_CACHE_KEY = "TMAIC_RATE_LIMIT_%s"
View Source
const RATE_LIMITE_TIMER_CACHE_KEY = "TMAIC_RATE_LIMIT_%s_TIMER"

Variables

This section is empty.

Functions

func Initialize

func Initialize()

Types

type Cacher

type Cacher interface {
	driver.ProtoCache
	driver.BasicCache
}

func Cache

func Cache() Cacher

func Store

func Store(store string) Cacher

type RateLimit

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

func NewRateLimit

func NewRateLimit(cache Cacher) *RateLimit

func (*RateLimit) Attempts

func (rl *RateLimit) Attempts(key string) int64

func (*RateLimit) AvailableIn

func (rl *RateLimit) AvailableIn(key string) zone.Duration

func (*RateLimit) Clear

func (rl *RateLimit) Clear(key string)

func (*RateLimit) Hit

func (rl *RateLimit) Hit(key string, decayMinutes int) int64

func (*RateLimit) ResetAttempts

func (rl *RateLimit) ResetAttempts(key string) bool

func (*RateLimit) RetriesLeft

func (rl *RateLimit) RetriesLeft(key string, maxAttempts int64) int64

func (*RateLimit) TooManyAttempts

func (rl *RateLimit) TooManyAttempts(key string, maxAttempts int64) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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