Skip to content

Commit 1471148

Browse files
committed
use setrefreshinterval isntead of setcacheexpiration
1 parent 3a6fb8a commit 1471148

6 files changed

+11
-11
lines changed

articles/azure-app-configuration/enable-dynamic-configuration-aspnet-core.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ A *sentinel key* is a key that you update after you complete the change of all o
5757
In the `ConfigureRefresh` method, you register keys you want to monitor for changes in your App Configuration store. The `refreshAll` parameter to the `Register` method indicates that all configurations you specified by the `Select` method will be reloaded if the registered key changes.
5858

5959
> [!TIP]
60-
> You can add a call to the `refreshOptions.SetCacheExpiration` method to specify the minimum time between configuration refreshes. In this example, you use the default value of 30 seconds. Adjust to a higher value if you need to reduce the number of requests made to your App Configuration store.
60+
> You can add a call to the `refreshOptions.SetRefreshInterval` method to specify the minimum time between configuration refreshes. In this example, you use the default value of 30 seconds. Adjust to a higher value if you need to reduce the number of requests made to your App Configuration store.
6161

6262
1. Add Azure App Configuration middleware to the service collection of your app.
6363

articles/azure-app-configuration/enable-dynamic-configuration-aspnet-netfx.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Add the following key-values to the App Configuration store and leave **Label**
8282
.ConfigureRefresh(refresh =>
8383
{
8484
refresh.Register("TestApp:Settings:Sentinel", refreshAll:true)
85-
.SetCacheExpiration(new TimeSpan(0, 5, 0));
85+
.SetRefreshInterval(new TimeSpan(0, 5, 0));
8686
});
8787
_configurationRefresher = options.GetRefresher();
8888
});
@@ -94,7 +94,7 @@ Add the following key-values to the App Configuration store and leave **Label**
9494

9595
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `refreshAll` parameter to the `Register` method indicates that all configuration values should be refreshed if the registered key changes. In this example, the key *TestApp:Settings:Sentinel* is a *sentinel key* that you update after you complete the change of all other keys. When a change is detected, your application refreshes all configuration values. This approach helps to ensure the consistency of configuration in your application compared to monitoring all keys for changes.
9696

97-
The `SetCacheExpiration` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 5 minutes instead. It reduces the potential number of requests made to your App Configuration store.
97+
The `SetRefreshInterval` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 5 minutes instead. It reduces the potential number of requests made to your App Configuration store.
9898

9999

100100
1. Add an `Application_BeginRequest` method to the `Global` class. If the method already exists, add the following code to it.

articles/azure-app-configuration/enable-dynamic-configuration-dotnet-background-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ You use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to create a
129129
```
130130
---
131131
132-
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. All settings registered for refresh have a default cache expiration of 30 seconds before a new refresh is attempted. It can be updated by calling the `AzureAppConfigurationRefreshOptions.SetCacheExpiration` method.
132+
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. All settings registered for refresh have a default cache expiration of 30 seconds before a new refresh is attempted. It can be updated by calling the `AzureAppConfigurationRefreshOptions.SetRefreshInterval` method.
133133
134134
1. Open *Worker.cs*. Inject `IConfiguration` and `IConfigurationRefresher` to the `Worker` service and log the configuration data from App Configuration.
135135

articles/azure-app-configuration/enable-dynamic-configuration-dotnet-core-push-refresh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace TestConsole
112112
refresh
113113
.Register("TestApp:Settings:Message")
114114
// Important: Reduce poll frequency
115-
.SetCacheExpiration(TimeSpan.FromDays(1))
115+
.SetRefreshInterval(TimeSpan.FromDays(1))
116116
);
117117

118118
_refresher = options.GetRefresher();

articles/azure-app-configuration/enable-dynamic-configuration-dotnet-core.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ builder.AddAzureAppConfiguration(options =>
4949
.ConfigureRefresh(refresh =>
5050
{
5151
refresh.Register("TestApp:Settings:Message")
52-
.SetCacheExpiration(TimeSpan.FromSeconds(10));
52+
.SetRefreshInterval(TimeSpan.FromSeconds(10));
5353
});
5454

5555
_refresher = options.GetRefresher();
@@ -70,7 +70,7 @@ if (_refresher != null)
7070
}
7171
```
7272

73-
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. The `SetCacheExpiration` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 10 seconds instead for demonstration purposes.
73+
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. The `SetRefreshInterval` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 10 seconds instead for demonstration purposes.
7474

7575
Calling the `ConfigureRefresh` method alone won't cause the configuration to refresh automatically. You call the `TryRefreshAsync` method from the interface `IConfigurationRefresher` to trigger a refresh. This design is to avoid requests sent to App Configuration even when your application is idle. You'll want to include the `TryRefreshAsync` call where you consider your application active. For example, it can be when you process an incoming message, an order, or an iteration of a complex task. It can also be in a timer if your application is active all the time. In this example, you call `TryRefreshAsync` every time you press the Enter key. Even if the call `TryRefreshAsync` fails for any reason, your application continues to use the cached configuration. Another attempt is made when the configured cache expiration time has passed and the `TryRefreshAsync` call is triggered by your application activity again. Calling `TryRefreshAsync` is a no-op before the configured cache expiration time elapses, so its performance impact is minimal, even if it's called frequently.
7676

@@ -159,7 +159,7 @@ In the previous code, you're manually saving an instance of `IConfigurationRefre
159159
![Quickstart app refresh local](./media/quickstarts/dotnet-core-app-run-refresh.png)
160160

161161
> [!NOTE]
162-
> Since the cache expiration time was set to 10 seconds using the `SetCacheExpiration` method while specifying the configuration for the refresh operation, the value for the configuration setting will only be updated if at least 10 seconds have elapsed since the last refresh for that setting.
162+
> Since the cache expiration time was set to 10 seconds using the `SetRefreshInterval` method while specifying the configuration for the refresh operation, the value for the configuration setting will only be updated if at least 10 seconds have elapsed since the last refresh for that setting.
163163

164164
## Logging and monitoring
165165

articles/azure-app-configuration/enable-dynamic-configuration-dotnet.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Add the following key-value to the App Configuration store and leave **Label** a
7878
.ConfigureRefresh(refresh =>
7979
{
8080
refresh.Register("TestApp:Settings:Message")
81-
.SetCacheExpiration(TimeSpan.FromSeconds(10));
81+
.SetRefreshInterval(TimeSpan.FromSeconds(10));
8282
});
8383

8484
_refresher = options.GetRefresher();
@@ -89,7 +89,7 @@ Add the following key-value to the App Configuration store and leave **Label** a
8989
}
9090
```
9191

92-
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. The `SetCacheExpiration` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 10 seconds instead for demonstration purposes.
92+
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. The `SetRefreshInterval` method specifies the minimum time that must elapse before a new request is made to App Configuration to check for any configuration changes. In this example, you override the default expiration time of 30 seconds, specifying a time of 10 seconds instead for demonstration purposes.
9393

9494
1. Add a method called `PrintMessage()` that triggers a refresh of configuration data from App Configuration.
9595

@@ -139,7 +139,7 @@ Add the following key-value to the App Configuration store and leave **Label** a
139139
![App refresh local](./media/dotnet-app-run-refresh.png)
140140

141141
> [!NOTE]
142-
> Since the cache expiration time was set to 10 seconds using the `SetCacheExpiration` method while specifying the configuration for the refresh operation, the value for the configuration setting will only be updated if at least 10 seconds have elapsed since the last refresh for that setting.
142+
> Since the cache expiration time was set to 10 seconds using the `SetRefreshInterval` method while specifying the configuration for the refresh operation, the value for the configuration setting will only be updated if at least 10 seconds have elapsed since the last refresh for that setting.
143143

144144
## Clean up resources
145145

0 commit comments

Comments
 (0)