Class TokenCache

java.lang.Object
land.oras.auth.TokenCache

@NullMarked public final class TokenCache extends Object
Cache for storing token responses based on scopes.
  • Field Details

    • MAX_CACHE_SIZE

      public static final int MAX_CACHE_SIZE
      Hard cache limit
      See Also:
  • Method Details

    • setMeterRegistry

      public static void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Set the meter registry for monitoring the cache metrics
      Parameters:
      meterRegistry - the meter registry to use for monitoring the cache metrics
    • put

      public static void put(Scopes scopes, HttpClient.TokenResponse token)
      Put a token response in the cache with the associated scopes.
      Parameters:
      scopes - The scopes associated with the token response
      token - The token response to be cached
    • get

      public static @Nullable HttpClient.TokenResponse get(Scopes scopes)
      Get a token response from the cache based on the provided scopes.
      Parameters:
      scopes - The scopes to look up in the cache
      Returns:
      the token response associated with the scopes, or null if not found or expired