An open API service indexing awesome lists of open source software.

https://github.com/streamdp/golimiter

Golang library to limiting something
https://github.com/streamdp/golimiter

Last synced: 11 months ago
JSON representation

Golang library to limiting something

Awesome Lists containing this project

README

          

## Golimiter

Library to limiting something: https request, loops, sends to the channel & etc.
Written on **golang** and used [microcache](https://github.com/streamdp/microcache) library.

### Usage
Example library usage for limiting **doSomething()** function on 10 calls per second:
```go
package main

import (
"context"
"time"
"github.com/streamdp/golimiter"
)

func main() {
l := golimiter.New(context.Background(), time.Minute)
if l.Allow("key1", 10, time.Second) {
doSomething()
}
}
```