public async Task <CacheResponse> IsCacheOutOfDate(DateTime cacheLastUpdatedTimeUtc, int appId, CancellationToken token) { var endpoint = configurationProvider.GetConnectionStringById(connectionStringKey); endpoint += $"?appId={appId}"; var gatewayResponse = await webGateway.GetResponseFromEndpoint <ResponseDao>(endpoint, token); if (gatewayResponse.ResultCode != WebRequestResponseResultCode.Succeeded) { return(CacheResponse.CacheCheckFailed(gatewayResponse.ResultMessage)); } var response = gatewayResponse.Value; if (!response.IsCached) { return(CacheResponse.OutOfDate()); } if (response.CachedDateTimeUtc < cacheLastUpdatedTimeUtc) { return(CacheResponse.NotOutOfDate()); } return(CacheResponse.OutOfDate()); }
public async Task <CacheResponse> IsCacheOutOfDate(DateTime cacheLastUpdatedTimeUtc, CancellationToken token) { var endpoint = configurationProvider.GetConnectionStringById(connectionStringKey); var gatewayResponse = await webGateway.GetResponseFromEndpoint <ResponseDao>(endpoint, token); if (!gatewayResponse.Succeeded) { return(CacheResponse.OutOfDate()); } var response = gatewayResponse.Value; if (!response.IsCached) { return(CacheResponse.OutOfDate()); } if (response.CachedDateTimeUtc < cacheLastUpdatedTimeUtc) { return(CacheResponse.NotOutOfDate()); } return(CacheResponse.OutOfDate()); }