0

What is the optimized way of caching data using redis in duende identity server 6?

I have already added redis cache on my duende identity server. Installed Microsoft.Extensions.Caching.StackExchangeRedis package then Added as a service in the startup file.

builder.Services.AddStackExchangeRedisCache(options => options.Configuration = "localhost:8088");

Then Injected as a dependency in the login file and used setString/getString method to store and retrive the data.

await _distributedCache.SetStringAsync(key, value); 
 string? cachedMember = await _distributedCache.GetStringAsync(key);

Is there any downside of doing caching in that way? Is there any better apparoach?

Kazi Minhaj
  • 51
  • 1
  • 8

0 Answers0