MySqlDataSourceBuilder.UsePeriodicPasswordProvider method
Configures a periodic password provider, which is automatically called by the data source at some regular interval. This is the recommended way to fetch a rotating access token.
public MySqlDataSourceBuilder UsePeriodicPasswordProvider(
Func<MySqlProvidePasswordContext, CancellationToken, ValueTask<string>>? passwordProvider,
TimeSpan successRefreshInterval, TimeSpan failureRefreshInterval)
parameter | description |
---|---|
passwordProvider | A callback which returns the password to be used by any new MySQL connections that are made. |
successRefreshInterval | How long to cache the password before re-invoking the callback. |
failureRefreshInterval | How long to wait before re-invoking the callback on failure. This should typically be much shorter than successRefreshInterval. |
Return Value
This builder, so that method calls can be chained.
See Also
- class MySqlProvidePasswordContext
- class MySqlDataSourceBuilder
- namespace MySqlConnector
- assembly MySqlConnector