Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

StoreMappingCacheEventConsumer.cs

using DocumentFormat.OpenXml.Drawing.Diagrams;
using Nop.Core.Domain.Stores;
using Nop.Services.Caching;
using Nop.Services.Catalog;

namespace Nop.Services.Stores.Caching;

/// 
/// Represents a store mapping cache event consumer
/// 
public partial class StoreMappingCacheEventConsumer : CacheEventConsumer
{
    /// 
    /// Clear cache data
    /// 
    /// Entity
    /// A task that represents the asynchronous operation
    protected override async Task ClearCacheAsync(StoreMapping entity)
    {
        await RemoveAsync(NopStoreDefaults.StoreMappingsCacheKey, entity.EntityId, entity.EntityName);
        await RemoveAsync(NopStoreDefaults.StoreMappingIdsCacheKey, entity.EntityId, entity.EntityName);
        await RemoveAsync(NopStoreDefaults.StoreMappingExistsCacheKey, entity.EntityName);

        if (entity.EntityName.Equals(nameof(Category)))
            await RemoveByPrefixAsync(NopCatalogDefaults.ChildCategoryIdLookupByStorePrefix, entity.StoreId);
    }
}