github.com/sethvargo/go-limiter@v1.0.0/noopstore/example_test.go (about)

     1  package noopstore_test
     2  
     3  import (
     4  	"context"
     5  	"log"
     6  
     7  	"github.com/sethvargo/go-limiter/noopstore"
     8  )
     9  
    10  func ExampleNew() {
    11  	ctx := context.Background()
    12  
    13  	store, err := noopstore.New()
    14  	if err != nil {
    15  		log.Fatal(err)
    16  	}
    17  	defer store.Close(ctx)
    18  
    19  	limit, remaining, reset, ok, err := store.Take(ctx, "my-key")
    20  	if err != nil {
    21  		log.Fatal(err)
    22  	}
    23  	_, _, _, _ = limit, remaining, reset, ok
    24  }