cloudflare

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const AlgorithmName = "cloudflare"

Variables

This section is empty.

Functions

func NewAlgorithm added in v0.0.11

func NewAlgorithm(rdb algorithm.Rediser) (algorithm.Algorithm, error)

Types

type Cloudflare

type Cloudflare struct {
	RDB algorithm.Rediser
}

func (*Cloudflare) Allow

func (c *Cloudflare) Allow(key string, limit algorithm.Limit) (*algorithm.Result, error)

type RedisDataStore

type RedisDataStore struct {
	RDB            algorithm.Rediser
	ExpirationTime time.Duration
}

func (*RedisDataStore) Get

func (s *RedisDataStore) Get(key string, previousWindow, currentWindow time.Time) (prevValue int64, currValue int64, err error)

func (*RedisDataStore) Inc

func (s *RedisDataStore) Inc(key string, window time.Time) error

Jump to

Keyboard shortcuts

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