Skip to content

Commit 0222275

Browse files
committed
explain about Refresh from Register's document (#830)
1 parent 3ef1dc5 commit 0222275

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jwk/cache.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ func NewCache(ctx context.Context, options ...CacheOption) *Cache {
166166
//
167167
// Please refer to the documentation for `(httprc.Cache).Register` for more
168168
// details.
169+
//
170+
// Register does not check for the validity of the url being registered.
171+
// If you need to make sure that a url is valid before entering your main
172+
// loop, call `Refresh` once to make sure the JWKS is available.
173+
//
174+
// _ = cache.Register(url)
175+
// if _, err := cache.Refresh(ctx, url); err != nil {
176+
// // url is not a valid JWKS
177+
// panic(err)
178+
// }
169179
func (c *Cache) Register(u string, options ...RegisterOption) error {
170180
var hrropts []httprc.RegisterOption
171181
var pf PostFetcher

0 commit comments

Comments
 (0)