Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
redis_rate
✓ github.com/go-redis/redis_rate/v9
Creates a rate limiter and checks if a request is allowed.
package main
import (
"context"
"fmt"
"github.com/go-redis/redis_rate/v9"
"github.com/redis/go-redis/v9"
)
func main() {
rdb := redis.NewClient(&redis.Options{Addr: "localhost:6379"})
limiter := redis_rate.NewLimiter(rdb)
res, err := limiter.Allow(context.Background(), "key", redis_rate.PerSecond(10))
if err != nil {
panic(err)
}
fmt.Println("Allowed:", res.Allowed)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
9.1.2latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.