private static void ResetCacheProductInfo() { ProductAdapter productAdapter = new ProductAdapter(new SqlDb(Server.ConnectionString)); CacheProductInfo c = new CacheProductInfo(new SqlDb(Server.ConnectionString)); Console.WriteLine("1- Reset all cache by company (domain)"); Console.WriteLine("2- Reset all cache"); Console.WriteLine("3- Reset only 'product_info' all company"); Console.WriteLine("4- Reset cache ProductInfo by domain"); Console.Write("Input choose:"); int i = Convert.ToInt32(Console.ReadLine()); switch (i) { case 1: { Console.Write("Input domain:"); string strDomain = Console.ReadLine().Trim(); c.RefreshAllCacheAllProduct(productAdapter.GetCompanyIDFromDomain(strDomain)); } break; case 2: { List <long> lstCompany = productAdapter.GetAllCompanyIdCrawler(); for (int j = 0; j < lstCompany.Count; j++) { c.RefreshAllCacheAllProduct(lstCompany[j]); log.Info(string.Format("Update company {0}/{1}", j, lstCompany.Count - 1)); } } break; case 3: { List <long> lstCompany = productAdapter.GetAllCompanyIdCrawler(); for (int j = 0; j < lstCompany.Count; j++) { c.ResetAllCacheProductInfo(lstCompany[j]); log.Info(string.Format("Update company {0}/{1}", j, lstCompany.Count - 1)); } } break; case 4: { Console.Write("Input domain:"); string strDomain = Console.ReadLine().Trim(); c.ResetForCompany(productAdapter.GetCompanyIDFromDomain(strDomain)); } break; } }
private void btnRefreshCacheProductInfo_Click(object sender, EventArgs e) { CacheProductInfo c = new CacheProductInfo(new SqlDb(QT.Entities.Server.ConnectionString)); c.RefreshAllCacheAllProduct(5793170764020693231); }