Package land.oras.auth
Class TokenCache
java.lang.Object
land.oras.auth.TokenCache
Cache for storing token responses based on scopes.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable HttpClient.TokenResponseGet a token response from the cache based on the provided scopes.static voidput(Scopes scopes, HttpClient.TokenResponse token) Put a token response in the cache with the associated scopes.static voidsetMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Set the meter registry for monitoring the cache metrics
-
Field Details
-
MAX_CACHE_SIZE
public static final int MAX_CACHE_SIZEHard 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
Put a token response in the cache with the associated scopes.- Parameters:
scopes- The scopes associated with the token responsetoken- The token response to be cached
-
get
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
-