mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
879 B
879 B
name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
| name | slug | sourceRef | category | subCategory | playUrl | variantHelpers | similarHelpers | position | signatures | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NewThrottleByWithCount | newthrottlebywithcount | retry.go#L377 | core | concurrency | https://go.dev/play/p/vQk3ECH7_EW |
|
|
100 |
|
Creates a throttled function per key with a per-interval invocation limit.
throttle, reset := lo.NewThrottleByWithCount[string](
100*time.Millisecond,
3,
func(key string) {
println(key)
},
)
for i := 0; i < 10; i++ {
throttle("foo")
}
reset()