diff --git a/Mango.Nop.Core/Repositories/MgDbContextBase.cs b/Mango.Nop.Core/Repositories/MgDbContextBase.cs index f360977..6beb71a 100644 --- a/Mango.Nop.Core/Repositories/MgDbContextBase.cs +++ b/Mango.Nop.Core/Repositories/MgDbContextBase.cs @@ -1,5 +1,6 @@ using Mango.Nop.Core.Interfaces; using Microsoft.AspNetCore.Http; +using Nop.Core.Caching; using Nop.Core.Domain.Catalog; using Nop.Core.Events; using Nop.Data; @@ -11,6 +12,11 @@ namespace Mango.Nop.Core.Repositories; public class MgDbContextBase : IMgDbContextBase { + //TODO: ez itt nem ay igazi, kitalálni vmit! - J. + //private readonly CacheKey _auctionAllKey = new("Nop.auction.all-{0}", AUCTION_PATTERN_KEY); + public const string AUCTION_PATTERN_KEY = "Nop.auction."; + + protected ILogger Logger; protected INopDataProvider DataProvider; //protected IHttpContextAccessor HttpContextAccessor; diff --git a/Mango.Nop.Core/Repositories/MgDbTableBase.cs b/Mango.Nop.Core/Repositories/MgDbTableBase.cs index a54da0a..abd425d 100644 --- a/Mango.Nop.Core/Repositories/MgDbTableBase.cs +++ b/Mango.Nop.Core/Repositories/MgDbTableBase.cs @@ -19,7 +19,6 @@ public class MgDbTableBase(IEventPublisher eventPublisher, INopDataProv protected IEventPublisher EventPublisher = eventPublisher; protected INopDataProvider DataProvider = dataProvider; protected IShortTermCacheManager ShortTermCacheManager = shortTermCacheManager; - protected IStaticCacheManager StaticCacheManager = staticCacheManager; #region SetTimeStampInfos private static void SetTimeStampCreated(TEntity entity) @@ -49,6 +48,8 @@ public class MgDbTableBase(IEventPublisher eventPublisher, INopDataProv { SetTimeStampCreated(entity); SetTimeStampModified(entity); + + //_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY); } private void OnUpdate(IList entities) @@ -56,7 +57,13 @@ public class MgDbTableBase(IEventPublisher eventPublisher, INopDataProv foreach (var entity in entities) OnUpdate(entity); } - protected virtual void OnUpdate(TEntity entity) => SetTimeStampModified(entity); + protected virtual void OnUpdate(TEntity entity) + { + SetTimeStampModified(entity); + + _staticCacheManager.ClearAsync().GetAwaiter().GetResult(); + //_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY); + } private void OnDelete(IList entities) { @@ -70,6 +77,7 @@ public class MgDbTableBase(IEventPublisher eventPublisher, INopDataProv SetTimeStampModified(entity); } + //_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY); } #endregion OnCrudEvents