Skip to content

Commit e31f5b0

Browse files
authored
Merge pull request #301 from neozhu/ownernavigation
add cache Refresh()
2 parents 141e020 + 2a8265f commit e31f5b0

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/Application/Features/Customers/Caching/CustomerCacheKey.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static CancellationTokenSource SharedExpiryTokenSource()
2929
}
3030
return _tokensource;
3131
}
32+
public static void Refresh() => SharedExpiryTokenSource().Cancel();
3233
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
3334
}
3435

src/Application/Features/Products/Caching/ProductCacheKey.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static CancellationTokenSource SharedExpiryTokenSource() {
2424
}
2525
return _tokensource;
2626
}
27+
public static void Refresh()=> SharedExpiryTokenSource().Cancel();
2728
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
2829
}
2930

src/Blazor.Server.UI/Pages/Products/Products.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@using AutoMapper
44
@using BlazorDownloadFile
5+
@using CleanArchitecture.Blazor.Application.Features.Products.Caching;
56
@using CleanArchitecture.Blazor.Application.Features.Products.Commands.Delete
67
@using CleanArchitecture.Blazor.Application.Features.Products.Commands.Import
78
@using CleanArchitecture.Blazor.Application.Features.Products.DTOs
@@ -275,6 +276,7 @@
275276
}
276277
private async Task OnRefresh()
277278
{
279+
ProductCacheKey.Refresh();
278280
_selectedItems = new();
279281
_searchString = string.Empty;
280282
await _table.ReloadServerData();

0 commit comments

Comments
 (0)