I am trying to use Akavache's BlobCache.InMemory.GetOrCreateObject
to add caching to one of my database table, when I call it asynchronously, everything is fine. But since async requires caller to change to async as well and there are a lot of places to change, so I opt to call BlobCache.InMemory.GetOrCreateObject
synchronously instead by doing something like below
public async Task<List<T>> GetAllDataAsync() => await BlobCache.InMemory.GetOrCreateObject(...);
public List<T> GetAllData() => GetAllDataAsync().Result;
This will cause deadlock. What have I done wrong?
Edit1: This code is running in a ASP.NET Web API