Skip to content

Commit f341de8

Browse files
committed
Fix Api-Version cache.
1 parent 02354e6 commit f341de8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal static Task<string> DetermineApiVersion(AzureContext context, string re
5959
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
6060
internal static Task<string> DetermineApiVersion(AzureContext context, string providerNamespace, string resourceType, CancellationToken cancellationToken, bool? pre = null, Dictionary<string, string> cmdletHeaderValues = null)
6161
{
62-
var cacheKey = ApiVersionCache.GetCacheKey(providerNamespace: providerNamespace, resourceType: resourceType);
62+
var cacheKey = ApiVersionCache.GetCacheKey(context.Environment.Name, providerNamespace: providerNamespace, resourceType: resourceType);
6363
var apiVersions = ApiVersionCache.Instance
6464
.AddOrGetExisting(cacheKey: cacheKey, getFreshData: () => ApiVersionHelper.GetApiVersionsForResourceType(
6565
context,
@@ -206,11 +206,12 @@ private void SetCacheItem(string cacheKey, string[] data, DateTimeOffset absolut
206206
/// <summary>
207207
/// Gets the cache key.
208208
/// </summary>
209+
/// <param name="environmentName">The environment name.</param>
209210
/// <param name="providerNamespace">The provider namespace.</param>
210211
/// <param name="resourceType">The resource type.</param>
211-
internal static string GetCacheKey(string providerNamespace, string resourceType)
212+
internal static string GetCacheKey(string environmentName, string providerNamespace, string resourceType)
212213
{
213-
return string.Format("{0}/{1}", providerNamespace.CoalesceString(), resourceType.CoalesceString()).ToUpperInvariant();
214+
return string.Format("{0}/{1}/{2}", environmentName.CoalesceEnumerable(), providerNamespace.CoalesceString(), resourceType.CoalesceString()).ToUpperInvariant();
214215
}
215216
}
216217
}

0 commit comments

Comments
 (0)