Exemplo n.º 1
0
        public static async Task UpdateCacheAsync()
        {
            var urlApi = "https://coronavirus-tracker-api.herokuapp.com/all";

            Caching.ClearCacheOlderThan("covid-all", 1);

            if (!CacheFilename.IsFileCacheExist())
            {
                Log.Information($"Getting information from {urlApi}");
                var covidAll = await urlApi.GetJsonAsync <CovidAll>()
                               .ConfigureAwait(false);

                await covidAll.WriteCacheAsync(CacheFilename)
                .ConfigureAwait(false);
            }
            else
            {
                Log.Information("Covid Cache has updated.");
            }
        }