Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Set cache time 60 minutes for home page bestsellers component

KrzysztofPajak930b26efbc7e
diff --git a/src/Web/Grand.Web/Components/HomePageBestSellers.cs b/src/Web/Grand.Web/Components/HomePageBestSellers.cs
index b656d8bc6..59589e37e 100644
--- a/src/Web/Grand.Web/Components/HomePageBestSellers.cs
+++ b/src/Web/Grand.Web/Components/HomePageBestSellers.cs
@@ -56,6 +56,8 @@ namespace Grand.Web.Components
return Content("");
var productIds = new List<string>();
+
+ var cachetime = 60;
//load and cache report
if (_catalogSettings.BestsellersFromReports)
@@ -66,14 +68,14 @@ namespace Grand.Web.Components
createdFromUtc: fromdate,
ps: Domain.Payments.PaymentStatus.Paid,
storeId: _workContext.CurrentStore.Id,
- pageSize: _catalogSettings.NumberOfBestsellersOnHomepage));
+ pageSize: _catalogSettings.NumberOfBestsellersOnHomepage), cachetime);
productIds = report.Select(x => x.ProductId).ToList();
}
else
{
productIds = await _cacheBase.GetAsync(CacheKeyConst.BESTSELLER_PRODUCTS_MODEL_KEY,
- async () => (await _productService.GetAllProductsDisplayedOnBestSeller()).ToList());
+ async () => (await _productService.GetAllProductsDisplayedOnBestSeller()).ToList(), cachetime);
}
//load products