DEV Community

Discussion on: Distributed Caching In ASP.Net Core Using Redis

Collapse
 
amiradeli profile image
amiradeli

Thank you for this post.
Actually, the return type of Get method is IEnumerable and there is a compilation error when we return cachedWeatherResult which is string.
How can cachedWeatherResult be converted to the correct return type?

Collapse
 
samtimberlan profile image
Tim Udoma

Hello Amiradelli,

The return method of Get method is a task of IEnumerable. To get the correct return type for cached result, the sample uses GetCacheValueAsync() method which does the conversion using JsonConvert deserialization.

Here is a link to the implementation on GitHub: github.com/samtimberlan/Distribute...