github.com/ulule/limiter/v3@v3.11.3-0.20230613131926-4cb9c1da4633/limiter_test.go (about)

     1  package limiter_test
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/ulule/limiter/v3"
     7  	"github.com/ulule/limiter/v3/drivers/store/memory"
     8  )
     9  
    10  func New(options ...limiter.Option) *limiter.Limiter {
    11  	store := memory.NewStore()
    12  	rate := limiter.Rate{
    13  		Period: 1 * time.Second,
    14  		Limit:  int64(10),
    15  	}
    16  	return limiter.New(store, rate, options...)
    17  }