MCPcopy
hub / github.com/grpc/grpc-go / cachedMetadata

Method cachedMetadata

credentials/sts/sts.go:236–245  ·  view source on GitHub ↗

cachedMetadata returns the cached metadata provided it is not going to expire anytime soon. Caller must hold c.mu.

()

Source from the content-addressed store, hash-verified

234//
235// Caller must hold c.mu.
236func (c *callCreds) cachedMetadata() map[string]string {
237 now := time.Now()
238 // If the cached token has not expired and the lifetime remaining on that
239 // token is greater than the minimum value we are willing to accept, go
240 // ahead and use it.
241 if c.tokenExpiry.After(now) && c.tokenExpiry.Sub(now) > minCachedTokenLifetime {
242 return c.tokenMetadata
243 }
244 return nil
245}
246
247// constructRequest creates the STS request body in JSON based on the provided
248// options.

Callers 1

GetRequestMetadataMethod · 0.95

Calls 1

NowMethod · 0.80

Tested by

no test coverage detected