public async Task <ActionResult <List <ElectionMeta> > > GetBallots() { var result = await _resultsAggregator.GetAllBallots(); if (result.IsSuccess) { return(result.Value); } return(StatusCode(500, result.Error)); }
public async Task <ActionResult <List <ElectionMeta> > > GetBallots() { var result = await _appCache.GetOrAddAsync( "ballots", () => _resultsAggregator.GetAllBallots(), DateTimeOffset.Now.AddMinutes(120)); if (result.IsSuccess) { return(result.Value); } return(StatusCode(500, result.Error)); }