public virtual AccountsHistory GetAccounts_History(string accountNumber, AccountsHistory_Range range, AccountsHistory_Transactions transactions) { NameValueCollection q = new NameValueCollection(); q.Add("range", range.ToString().ToLower()); q.Add("transactions", transactions.ToString().ToLower()); RequestData req = new RequestData(RequestMethod.GET, "accounts/" + accountNumber + "/history", true, q, null, null); string response = RequestSync(req); return JsonConvert.DeserializeObject<AccountsHistory>(response); }
public override AccountsHistory GetAccounts_History(string accountNumber, AccountsHistory_Range range, AccountsHistory_Transactions transactions) { TkCacheData cache = null; string key = accountNumber + range.ToString() + transactions.ToString(); foreach (TkCacheData c in _accounts_History) { if (c.Key == key) { cache = c; break; } } // Add if not found if (cache == null) { cache = new TkCacheData(); cache.Key = key; _accounts_History.Add(cache); } TimeSpan ts = DateTime.Now - cache.AccessTime; if (ts.TotalMilliseconds > CacheTimeout) { RetryFunc(() => cache.Data = base.GetAccounts_History(accountNumber, range, transactions), RetryCount, RetryDelay); cache.AccessTime = DateTime.Now; } return (AccountsHistory)cache.Data; }