using Nop.Core.Domain.Customers; using Nop.Services.Caching; namespace Nop.Services.Customers.Caching; /// /// Represents a customer role cache event consumer /// public partial class CustomerRoleCacheEventConsumer : CacheEventConsumer { /// /// Clear cache by entity event type /// /// Entity /// Entity event type /// A task that represents the asynchronous operation protected override async Task ClearCacheAsync(CustomerRole entity, EntityEventType entityEventType) { switch (entityEventType) { case EntityEventType.Update: await RemoveByPrefixAsync(NopCustomerServicesDefaults.CustomerRolesBySystemNamePrefix); break; case EntityEventType.Delete: await RemoveAsync(NopCustomerServicesDefaults.CustomerRolesBySystemNameCacheKey, entity.SystemName); break; } if (entityEventType != EntityEventType.Insert) await RemoveByPrefixAsync(NopCustomerServicesDefaults.CustomerCustomerRolesPrefix); await base.ClearCacheAsync(entity, entityEventType); } }