I created a Schedule task and on exectue i added
_staticCacheManager.RemoveByPrefix("Nop.totals.productprice");
but its not gonna work, what should i do ?
Thank you.
NopCommerce 4.30 Verison.
using Nop.Core.Domain.Catalog;
using Nop.Core.Caching;
using Nop.Services.Caching;
using Nop.Services.Orders;
using Nop.Services.Tasks;
using Nop.Services.Logging;
using Nop.Services.Catalog;
namespace Nop.Services.Caching
{
/// <summary>
/// Clear cache scheduled task implementation
/// </summary>
public partial class ClearCacheTaskGenelec : IScheduleTask
{
#region Fields
private readonly IStaticCacheManager _staticCacheManager;
private readonly ILogger _logger;
private readonly ICacheKeyService _cacheKeyService;
#endregion
#region Ctor
public ClearCacheTaskGenelec(IStaticCacheManager staticCacheManager,
ILogger logger,
ICacheKeyService cacheKeyService)
{
_staticCacheManager = staticCacheManager;
_logger = logger;
_cacheKeyService = cacheKeyService;
}
#endregion
#region Methods
/// <summary>
/// Executes a task
/// </summary>
public void Execute()
{
//var cacheKey = _cacheKeyService.PrepareKey(NopCatalogDefaults.ProductTierPricesCacheKey);
//var cacheKey = _cacheKeyService.PrepareKey(NopCatalogDefaults.ProductsByIdsCacheKey);
//_staticCacheManager.Remove(cacheKey);
//var prefix = _cacheKeyService.PrepareKeyPrefix(NopCatalogDefaults.ProductPricePrefixCacheKey);
//_staticCacheManager.RemoveByPrefix(prefix);
_staticCacheManager.RemoveByPrefix("Nop.totals.productprice-");
_logger.Information("Izvrseno");
}
#endregion
}
}