public async Task <int> GetPictureCallageCount() { ApiResult <int> result = new ApiResult <int>(); string url = $"{Constants.RANDOM_PICTURE_COLLAGE_COUNT_URL}"; int count; try { if (_cache.TryGetCache <int>(url, out count)) { result.Results = count; _logger.LogInformation($"'{count}' for '{url}' was received from cache"); } else { result = await _restClient.GetAsync <int>($"{Constants.RANDOM_PICTURE_COLLAGE_COUNT_URL}"); _cache.SetCache <int>(url, result.Results, 10000); _logger.LogInformation($"'{result}' for '{url}' is now cached for 10000s"); } } catch (Exception ex) { _logger.LogError($"!!! ERROR !!! {ex.ToString()}"); } return(result.Results); }