Skip to main content

cached

Function cached 

Source
pub fn cached(src: SharedTokenSource) -> SharedTokenSource
Expand description

Reuses a token until a minute before the exp claim of the JWT. Tokens whose expiry can’t be read are cached for five minutes. Concurrent callers share one fetch, which runs on its own task, so one caller giving up (dropping its future) doesn’t fail the others. The client drops the cached token when the plane answers Unauthenticated (see TokenSource::invalidate).