Which would be a valid implementation of ValueTask
please?
Cache service returns data either from cache or DB.
public async ValueTask<IList<HrEmploymentDataCustom>> GetEmployeesFacts()
{
try
{
var facts = (List<HrEmploymentDataCustom>) _memoryCache.Get("facts");
return facts ?? await _accountService.GetEmploymentFacts(DetailsRequestType.All, null);
}
catch (Exception e)
{
var tc = new TelemetryClient();
tc.TrackException(e);
return null;
}
}
Would this be: var employeesFacts = await _cacheService.GetEmployeesFacts();
or var employeesFacts = _cacheService.GetEmployeesFacts().Result;
Little bit confused here.