0

my Web API is using Azure Redis Cache with NuGet version 2.6.66. and connection string set as{account}.redis.cache.windows.net,ssl=True,password={pwd},abortConnect=false

and reading cached data as

WrappedConnectionMultiplexer wrappedConnectionMultiplexer;
if (!myDictionary.TryGetValue(connectionString, out wrappedConnectionMultiplexer))
 {
   wrappedConnectionMultiplexer = new WrappedConnectionMultiplexer(connectionString, preserveAsyncOrder);
   myDictionary.AddOrUpdate(connectionString, (key) => wrappedConnectionMultiplexer, (key, x`) => wrappedConnectionMultiplexer);
 }

var cacheDatabase = await Task.FromResult(wrappedConnectionMultiplexer.GetDatabase());
await cacheDatabase.StringGetAsync(string key);

But if the key doesn't exist or account name is incorrect. I see different behavior in .NET framework 4.6.1 and .NET 6.0

.Net framework 4.6.1 StringGetAsync() will immediately return Or connection exception if account is incorrect in connection string.

.net 6.0 StringGetAsync() doesn't return (until the app monitoring code cancel the request after application timeout of 10 sec).

in both .NET versions, StringSetAsync is executed with CommandFlags.FireandForgot and call immediately return.

Is this difference expected or there is different way to use redis in 6.0.

Thanks

user9297554
  • 347
  • 4
  • 17

0 Answers0