cached method

CachingTokenSource cached({
  1. TokenStore? store,
  2. TokenValidator? validator,
})

Wraps this token source with caching capabilities.

The returned token source will reuse valid tokens and only fetch new ones when needed.

  • Parameters:
    • store: The store implementation to use for caching (defaults to in-memory store)
    • validator: A function to determine if cached credentials are still valid (defaults to JWT expiration check)
  • Returns: A caching token source that wraps this token source

Implementation

CachingTokenSource cached({
  TokenStore? store,
  TokenValidator? validator,
}) =>
    CachingTokenSource(
      this,
      store: store,
      validator: validator,
    );