zclipper

package
v0.0.0-...-325af03 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEnoughArgs           = errors.New("not enough args")
	ErrBadArgs                 = errors.New("bad args")
	ErrFallbackFail            = errors.New("fallback fail")
	ErrInitFailNoReloadControl = errors.New("init fail no reload control")
	ErrNotValidConf            = errors.New("not valid config")
	ErrWrongInterval           = errors.New("wrong interval")
	ErrReload2EmptyKey         = errors.New("reload to empty key")
)

Functions

This section is empty.

Types

type FallbackInt64Func

type FallbackInt64Func func(ctx context.Context, key string) (int64, error)

func DefaultFallbackFunc

func DefaultFallbackFunc(arg int64) FallbackInt64Func

type FallbackInt64PairFunc

type FallbackInt64PairFunc func(ctx context.Context, key string) (int64, int64, error)

func DefaultFallbackPairFunc

func DefaultFallbackPairFunc(limit, bucket int64) FallbackInt64PairFunc

type IntervalFunc

type IntervalFunc func(ctx context.Context, key string) (time.Duration, error)

func DefaultIntervalFuncWrapper

func DefaultIntervalFuncWrapper(interval time.Duration) IntervalFunc

type Mark

type Mark struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Mark) Do

func (m *Mark) Do()

func (*Mark) Doing

func (m *Mark) Doing() bool

func (*Mark) Done

func (m *Mark) Done()

type ReloadInt64Func

type ReloadInt64Func func(ctx context.Context, key string) (int64, error)

func DefaultReloadFunc

func DefaultReloadFunc(arg int64) ReloadInt64Func

func RedisReloadFunc

func RedisReloadFunc(redisCli *redis.Client) ReloadInt64Func

type ReloadInt64PairFunc

type ReloadInt64PairFunc func(ctx context.Context, key string) (int64, int64, error)

func DefaultReloadPairFunc

func DefaultReloadPairFunc(limit, bucket int64) ReloadInt64PairFunc

func RedisReloadPairFunc

func RedisReloadPairFunc(redisCli *redis.Client) ReloadInt64PairFunc

type ZClipper

type ZClipper interface {
	Add(ctx context.Context, api string, reloadFunc ReloadInt64Func, fallbackFunc FallbackInt64Func, intervalFunc IntervalFunc) error
	Allow(ctx context.Context, api string) bool
	Print()
}

Jump to

Keyboard shortcuts

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