public object Get(string key) { if (!string.IsNullOrWhiteSpace(key)) { return(SerializerHelper.FromJson <object>(_cache.StringGet(GetKeyForRedis(key)))); } throw new NotImplementedException(); }
public T Get <T>(string key) where T : class { if (!string.IsNullOrWhiteSpace(key)) { return(SerializerHelper.FromJson <T>(_cache.StringGet(GetKeyForRedis(key)))); } throw new NotImplementedException(); }
public T GetValue <T>(string key, T defaultValue) { T value; if (Preferences.ContainsKey(key)) { value = SerializerHelper.FromJson <T>(Preferences.Get(key, defaultValue.ToString()).ToString()); } else { value = defaultValue; } return(value); }
public async Task <ResponseInfo <CurrencyRatesHistoryResponse> > GetRatesHistoryByRange(string baseCode, string targetCode, string range, string interval) { var url = $"{AppConfigurations.ApiUrl}GetHistoryRatesByRange?baseCode={baseCode}&targetCode={targetCode}&range={range}&interval={interval}&api-version=1.0"; var result = new ResponseInfo <CurrencyRatesHistoryResponse>(); try { var response = await _httpClientService.CreateClient().GetAsync(url); if (response.IsSuccessStatusCode) { var responseString = await response.Content.ReadAsStringAsync(); result = SerializerHelper.FromJson <ResponseInfo <CurrencyRatesHistoryResponse> >(responseString); } return(result); } catch { result.Message = "Service unavailable."; return(result); } }