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.

Minor update cache memory

support532ecd3df482
diff --git a/src/Core/Grand.Infrastructure/Caching/MemoryCacheBase.cs b/src/Core/Grand.Infrastructure/Caching/MemoryCacheBase.cs
index 9621a5542..9e2f43f89 100644
--- a/src/Core/Grand.Infrastructure/Caching/MemoryCacheBase.cs
+++ b/src/Core/Grand.Infrastructure/Caching/MemoryCacheBase.cs
@@ -36,14 +36,14 @@ namespace Grand.Infrastructure.Caching
#region Methods
- public virtual async Task<T> GetAsync<T>(string key, Func<Task<T>> acquire)
+ public virtual Task<T> GetAsync<T>(string key, Func<Task<T>> acquire)
{
- return await GetAsync(key, acquire, CommonHelper.CacheTimeMinutes);
+ return GetAsync(key, acquire, CommonHelper.CacheTimeMinutes);
}
- public virtual async Task<T> GetAsync<T>(string key, Func<Task<T>> acquire, int cacheTime)
+ public virtual Task<T> GetAsync<T>(string key, Func<Task<T>> acquire, int cacheTime)
{
- return await _cache.GetOrCreateAsync(key, entry =>
+ return _cache.GetOrCreateAsync(key, entry =>
{
entry.SetOptions(GetMemoryCacheEntryOptions(cacheTime));
entry.SetKey(_cacheEntries);
diff --git a/src/Web/Grand.Web/Components/HomePageBestSellers.cs b/src/Web/Grand.Web/Components/HomePageBestSellers.cs
index 8805cfe2f..d26e25b3a 100644
--- a/src/Web/Grand.Web/Components/HomePageBestSellers.cs
+++ b/src/Web/Grand.Web/Components/HomePageBestSellers.cs
@@ -53,8 +53,6 @@ namespace Grand.Web.Components
var productIds = new List<string>();
- var cachetime = 60;
-
//load and cache report
if (_catalogSettings.BestsellersFromReports)
{
@@ -64,14 +62,14 @@ namespace Grand.Web.Components
createdFromUtc: fromdate,
ps: Domain.Payments.PaymentStatus.Paid,
storeId: _workContext.CurrentStore.Id,
- pageSize: _catalogSettings.NumberOfBestsellersOnHomepage), cachetime);
+ pageSize: _catalogSettings.NumberOfBestsellersOnHomepage));
productIds = report.Select(x => x.ProductId).ToList();
}
else
{
productIds = await _cacheBase.GetAsync(CacheKeyConst.BESTSELLER_PRODUCTS_MODEL_KEY,
- async () => (await _productService.GetAllProductsDisplayedOnBestSeller()).ToList(), cachetime);
+ async () => (await _productService.GetAllProductsDisplayedOnBestSeller()).ToList());
}
//load products
diff --git a/src/Web/Grand.Web/Components/Widget.cs b/src/Web/Grand.Web/Components/Widget.cs
index 74ec3b11f..9faa756ff 100644
--- a/src/Web/Grand.Web/Components/Widget.cs
+++ b/src/Web/Grand.Web/Components/Widget.cs
@@ -43,7 +43,7 @@ namespace Grand.Web.ViewComponents
model.Add(widgetModel);
}
- return await Task.FromResult(model);
+ return model;
});
if (!cachedModel.Any())
diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.cs
index 09348b8de..c7d907383 100644
--- a/src/Web/Grand.Web/Controllers/InstallController.cs
+++ b/src/Web/Grand.Web/Controllers/InstallController.cs
@@ -277,7 +277,7 @@ namespace Grand.Web.Controllers
migrationProcess.InstallApplication();
//restart application
- await _cacheBase.GetAsync("Installed", () => Task.FromResult(true), 120);
+ await _cacheBase.GetAsync("Installed", () => Task.FromResult(true));
return View(new InstallModel() { Installed = true });
}
catch (Exception exception)