Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Distributed ¶
type Distributed struct {
// contains filtered or unexported fields
}
Distributed is redis limiter.
Example ¶
nolint: testableexamples
client := redis.NewClient(&redis.Options{ Addr: "localhost:6379", Password: "", DB: 0, }) start := time.Now() limiter := rdb.NewDistributed(client, "key", 1000, time.Second) ctx := context.Background() _ = limiter.Wait(ctx) _ = limiter.Wait(ctx) _ = limiter.Wait(ctx) fmt.Println(time.Since(start))
Output:
func NewDistributed ¶
func NewDistributed(client redis.Cmdable, key string, qps int, timeOut time.Duration) *Distributed
NewDistributed returns redis limiter.
Click to show internal directories.
Click to hide internal directories.