gitlab.com/infor-cloud/martian-cloud/tharsis/go-limiter@v0.0.0-20230411193226-3247984d5abc/noopstore/example_test.go (about)

     1  package noopstore_test
     2  
     3  import (
     4  	"context"
     5  	"log"
     6  
     7  	"gitlab.com/infor-cloud/martian-cloud/tharsis/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  }