public List <CompanyStatsIEX> GetCachedCompaniesIEX() { List <CompanyStatsIEX> cachedCompanies = new List <CompanyStatsIEX>(); HashSet <string> cachedSymbols = _cache.GetCachedSymbols("iex-companies"); foreach (string cacheKey in cachedSymbols) { CompanyStatsIEX company = (CompanyStatsIEX)_cache.Get(cacheKey); if (company != null) { cachedCompanies.Add(company); } } return(cachedCompanies); }
//Investors Exchange Company Cache Entry Update Routine //DEPRECATED public void UpdateIEXCompanyCacheEntry(object key, object value, EvictionReason reason, object state = null) { try { Stopwatch sw = new Stopwatch(); sw.Start(); string cacheKey = (string)key; string channel = cacheKey.Split('-')[0]; string symbol = cacheKey.Split('-')[2]; //Remove before updating and re-adding RemoveCachedSymbol(cacheKey); CompanyStatsIEX companyStats = new CompanyStatsIEX(); //IEX.GetCompanyStatsAsync(symbol).Result; //Save IEX Company to cache this.Add(companyStats, cacheKey); string perf = sw.ElapsedMilliseconds.ToString(); } catch (Exception e) { Debug.WriteLine("ERROR UpdateIEXCompanyCacheEntry: " + e.Message); } }