diff --git a/src/Application/Features/Customers/Caching/CustomerCacheKey.cs b/src/Application/Features/Customers/Caching/CustomerCacheKey.cs index d5878c0dd..cf6315c7d 100644 --- a/src/Application/Features/Customers/Caching/CustomerCacheKey.cs +++ b/src/Application/Features/Customers/Caching/CustomerCacheKey.cs @@ -29,6 +29,7 @@ public static CancellationTokenSource SharedExpiryTokenSource() } return _tokensource; } + public static void Refresh() => SharedExpiryTokenSource().Cancel(); public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token)); } diff --git a/src/Application/Features/Products/Caching/ProductCacheKey.cs b/src/Application/Features/Products/Caching/ProductCacheKey.cs index 7a38f8670..1bd09c40d 100644 --- a/src/Application/Features/Products/Caching/ProductCacheKey.cs +++ b/src/Application/Features/Products/Caching/ProductCacheKey.cs @@ -24,6 +24,7 @@ public static CancellationTokenSource SharedExpiryTokenSource() { } return _tokensource; } + public static void Refresh()=> SharedExpiryTokenSource().Cancel(); public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token)); } diff --git a/src/Blazor.Server.UI/Pages/Products/Products.razor b/src/Blazor.Server.UI/Pages/Products/Products.razor index 8cd3be2c9..a286b7c3c 100644 --- a/src/Blazor.Server.UI/Pages/Products/Products.razor +++ b/src/Blazor.Server.UI/Pages/Products/Products.razor @@ -2,6 +2,7 @@ @using AutoMapper @using BlazorDownloadFile +@using CleanArchitecture.Blazor.Application.Features.Products.Caching; @using CleanArchitecture.Blazor.Application.Features.Products.Commands.Delete @using CleanArchitecture.Blazor.Application.Features.Products.Commands.Import @using CleanArchitecture.Blazor.Application.Features.Products.DTOs @@ -275,6 +276,7 @@ } private async Task OnRefresh() { + ProductCacheKey.Refresh(); _selectedItems = new(); _searchString = string.Empty; await _table.ReloadServerData();