I've currently been delving into the IConfigurationRefresher
functionality, and the SetDirty()
and RefreshAsync()
methods that it provides.
This is the main code that I'm using, which is currently refreshing the cache of the FeatureManagement package when a certain API endpoint is called:
Log.Logger.Information($"Refreshing app config.");
_refresher.SetDirty(TimeSpan.FromSeconds(0));
await _refresher.RefreshAsync();
This works great when working with a single hosted instance of a service/application, but how would this functionality work when there are multiple applications available via a loadbalancer in a web farm, or within a Kubernetes cluster with multiple pods?
Another question I have is if the caching is held locally in memory within the consuming service or is it distributed and cached in app config itself?
Scenario:
If a request to Application1 occurs, and the internal cache is refreshed. What would happen if any configuration/feature flags are retrieved from Azure App Configuration via the SDK? Would some calls have the updated values, due to the cache refresh, whilst the calls to the second application containing out of date values?