cached

fun CredentialsProvider.cached(expireCredentialsAfter: <Error class: unknown class> = DEFAULT_CREDENTIALS_REFRESH_SECONDS.seconds, refreshBufferWindow: <Error class: unknown class> = DEFAULT_CREDENTIALS_REFRESH_BUFFER_SECONDS.seconds, clock: <Error class: unknown class> = Clock.System): CachedCredentialsProvider

A utility function which wraps a CredentialsProvider in a CachedCredentialsProvider.

Return

the newly-constructed credentials provider

Parameters

expireCredentialsAfter

the default expiration time period for sourced credentials. For a given set of cached credentials, the refresh time period will be the minimum of this time and any expiration timestamp on the credentials themselves.

refreshBufferWindow

amount of time before the actual credential expiration time when credentials are considered expired. For example, if credentials are expiring in 15 minutes, and the buffer time is 10 seconds, then any requests made after 14 minutes and 50 seconds will load new credentials. Defaults to 10 seconds.

clock

the source of time for this provider