public void ResetCache(long companyId) { _productRepositoryProductCache.Clean(companyId); const int pageCount = 1000; int page = 0; do { var products = _productRepository.GetProductsForCacheCrawler(companyId, page++, pageCount); var enumerableProduct = products as Product[] ?? products.ToArray(); if (!enumerableProduct.Any()) { var productCaches = enumerableProduct.Select(variable => new ProductCache(variable)).ToList(); _productRepositoryProductCache.UpsertProducts(productCaches); } } while (true); }
public void CleanCache(long companyId) { _productCacheRepository.Clean(companyId); }