ratelimit

package module
v0.0.0-...-0530be6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 2 Imported by: 0

README

ratelimit

A distributed ratelimiter based on lua + redis

Usage

package main

import (
	"github.com/seaguest/ratelimit"
)

func main() {
	ratelimit.Init("127.0.0.1:6379", "")

	ratelimit.Take("1", 60, 100000, 1)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allow

func Allow(key string, duration, limit, requires int) (int64, error)

take requires token at a limit per duration for key.

func Init

func Init(address, password string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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