Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed cache query #20

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.6.0" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
<PackageReference Include="MediatR" Version="12.1.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.8" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.9" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TRe
{
_cache.Remove(request.CacheKey);
}
request.SharedExpiryTokenSource?.TryReset();
request.SharedExpiryTokenSource?.Cancel();

return response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

4 changes: 4 additions & 0 deletions src/Application/Features/Devices/Caching/DeviceCacheKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EmployeesWithPaginationQuery : PaginationFilter, IRequest<Paginated

public override string ToString()
{
return $"{base.ToString()},Name:{Name},Email:{Email},DepartmentId:{DepartmentId}";
return $"{base.ToString()},Name:{Name},Email:{Email},DepartmentId:{DepartmentId},SiteId:{SiteId}";
}
public string CacheKey => EmployeeCacheKey.GetPagtionCacheKey($"{this}");
public MemoryCacheEntryOptions? Options => EmployeeCacheKey.MemoryCacheEntryOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

4 changes: 4 additions & 0 deletions src/Application/Features/Sites/Caching/SiteCacheKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

4 changes: 4 additions & 0 deletions src/Application/Features/Visitors/Caching/VisitorCacheKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static CancellationTokenSource SharedExpiryTokenSource()
}
return _tokensource;
}
public static void Refresh()
{
SharedExpiryTokenSource().Cancel();
}
public static MemoryCacheEntryOptions MemoryCacheEntryOptions => new MemoryCacheEntryOptions().AddExpirationToken(new CancellationChangeToken(SharedExpiryTokenSource().Token));
}

4 changes: 2 additions & 2 deletions src/Blazor.Server.UI/Blazor.Server.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<PackageReference Include="Blazor-Analytics" Version="3.12.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazor-ApexCharts" Version="0.9.21-beta" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MudBlazor" Version="6.6.0" />
<PackageReference Include="MudBlazor" Version="6.8.0" />

<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/CheckinPoints/CheckinPoints.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/checkinPoints"


@using CleanArchitecture.Blazor.Application.Features.CheckinPoints.Caching;
@using CleanArchitecture.Blazor.Application.Features.CheckinPoints.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.CheckinPoints.DTOs
@using CleanArchitecture.Blazor.Application.Features.CheckinPoints.Queries.Pagination
Expand Down Expand Up @@ -274,6 +275,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
CheckinPointCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Designations/Designations.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/visitor/designations"
@using CleanArchitecture.Blazor.Application.Features.Designations.Caching;
@using CleanArchitecture.Blazor.Application.Features.Designations.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.Designations.DTOs
@using CleanArchitecture.Blazor.Application.Features.Designations.Queries.Pagination
Expand Down Expand Up @@ -240,6 +241,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
DesignationCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Devices/Devices.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/devices"


@using CleanArchitecture.Blazor.Application.Features.Devices.Caching;
@using CleanArchitecture.Blazor.Application.Features.Devices.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.Devices.DTOs
@using CleanArchitecture.Blazor.Application.Features.Devices.Queries.Pagination
Expand Down Expand Up @@ -268,6 +269,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
DeviceCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Employees/Employees.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/visitor/employees"

@using CleanArchitecture.Blazor.Application.Features.Employees.Caching;
@using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs
@using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.ByName
@using CleanArchitecture.Blazor.Application.Features.Employees.Commands.Delete
Expand Down Expand Up @@ -278,6 +279,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
EmployeeCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/siteconfigurations"


@using CleanArchitecture.Blazor.Application.Features.SiteConfigurations.Caching;
@using CleanArchitecture.Blazor.Application.Features.SiteConfigurations.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.SiteConfigurations.DTOs
@using CleanArchitecture.Blazor.Application.Features.SiteConfigurations.Queries.Pagination
Expand Down Expand Up @@ -208,6 +209,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
SiteConfigurationCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Sites/Sites.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/sites"


@using CleanArchitecture.Blazor.Application.Features.Sites.Caching;
@using CleanArchitecture.Blazor.Application.Features.Sites.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.Sites.DTOs
@using CleanArchitecture.Blazor.Application.Features.Sites.Queries.Pagination
Expand Down Expand Up @@ -255,6 +256,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
SiteCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnCreate()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Visitors/VisitorHistories.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/visitorhistories"


@using CleanArchitecture.Blazor.Application.Features.VisitorHistories.Caching;
@using CleanArchitecture.Blazor.Application.Features.VisitorHistories.Commands.Delete
@using CleanArchitecture.Blazor.Application.Features.VisitorHistories.DTOs
@using CleanArchitecture.Blazor.Application.Features.VisitorHistories.Queries.Pagination
Expand Down Expand Up @@ -159,6 +160,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
VisitorHistoryCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnDeleteChecked()
Expand Down
2 changes: 2 additions & 0 deletions src/Blazor.Server.UI/Pages/Visitors/Visitors.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/visitor/visitors"


@using CleanArchitecture.Blazor.Application.Features.Visitors.Caching;
@using CleanArchitecture.Blazor.Application.Features.Visitors.Commands.Approve
@using CleanArchitecture.Blazor.Application.Features.Visitors.Commands.Create
@using CleanArchitecture.Blazor.Application.Features.Visitors.Commands.Delete
Expand Down Expand Up @@ -372,6 +373,7 @@
{
_selectedItems = new();
_searchString = string.Empty;
VisitorCacheKey.Refresh();
await _table.ReloadServerData();
}
private async Task OnShowPreview(VisitorDto dto)
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
<PackageReference Include="FluentEmail.Smtp" Version="3.0.2" />
<PackageReference Include="FluentEmail.MailKit" Version="3.0.2" />
<PackageReference Include="MailKit" Version="4.1.0" />
<PackageReference Include="Hangfire.Core" Version="1.8.3" />
<PackageReference Include="Hangfire.Core" Version="1.8.4" />
<PackageReference Include="hashids.net" Version="1.7.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="6.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
<PackageReference Include="MimeKit" Version="4.1.0" />
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.0.3" />
<PackageReference Include="Duende.IdentityServer" Version="6.3.3" />
Expand Down
Loading