Rystem.RepositoryFramework.Cache
3.0.18
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Cache --version 3.0.18
NuGet\Install-Package Rystem.RepositoryFramework.Cache -Version 3.0.18
<PackageReference Include="Rystem.RepositoryFramework.Cache" Version="3.0.18" />
paket add Rystem.RepositoryFramework.Cache --version 3.0.18
#r "nuget: Rystem.RepositoryFramework.Cache, 3.0.18"
// Install Rystem.RepositoryFramework.Cache as a Cake Addin #addin nuget:?package=Rystem.RepositoryFramework.Cache&version=3.0.18 // Install Rystem.RepositoryFramework.Cache as a Cake Tool #tool nuget:?package=Rystem.RepositoryFramework.Cache&version=3.0.18
What is Rystem?
Cache
Examples
You can add a repository (with default blob integration for instance) and after attack an in memory cache for all methods. The RefreshTime is a property that adds an Expiration date to the cached value, in the example below you can see that after 20 seconds the in memory cache requests again to the repository pattern a new value for each key. The Methods is a flag that allows to setup what operations have to be cached.
Query → query will be cached with this key
var keyAsString = $"{nameof(RepositoryMethods.Query)}_{typeof(T).Name}_{filter.ToKey()}";
Operation → operation will be cached with this key
var keyAsString = $"{nameof(RepositoryMethods.Operation)}_{operation.Name}_{typeof(T).Name}_{filter.ToKey()}";
Get → query will be cached with this key
var keyAsString = $"{nameof(RepositoryMethods.Get)}_{typeof(T).Name}_{key.AsString()}";
Exist → query will be cached with this key
var keyAsString = $"{nameof(RepositoryMethod.Exist)}_{typeof(T).Name}_{key.AsString()}";
Now you can understand the special behavior for commands. If you set Insert and/or Update and/or Delete, during any command if you allowed it for each command automatically the framework will update the cache value, with updated or inserted value or removing the deleted value. The code below allows everything
x.Methods = RepositoryMethod.All
In the example below you're setting up the following behavior: setting up a cache only for Get operation, and update the Get cache when exists a new Insert or an Update, or a removal when Delete operation were perfomed.
x.Methods = RepositoryMethod.Get | RepositoryMethod.Insert | RepositoryMethod.Update | RepositoryMethod.Delete
Setup in DI
builder.Services
.AddRepositoryInBlobStorage<User, string>(builder.Configuration["ConnectionString:Storage"])
.WithInMemoryCache(x =>
{
x.RefreshTime = TimeSpan.FromSeconds(20);
x.Methods = RepositoryMethod.All;
})
Usage
You always will find the same interface. For instance
IRepository<User, string> repository
or if you added a query pattern or command pattern
IQuery<User, string> query
ICommand<User, string> command
Distributed Cache
Based on this link you may use the standard interface IDistributedCache instead of create a custom IDistributedCache<T, TKey, TState>. For instance you may choose between three libraries: Distributed SQL Server cache, Distributed Redis cache, Distributed NCache cache. You need to add the cache
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration.GetConnectionString("MyRedisConStr");
options.InstanceName = "SampleInstance";
});
then you add the IDistributedCache implementation to your repository patterns or CQRS.
builder.Services.
AddRepository<User, UserRepository>()
WithDistributedCache();
and as always you will use the standard interface that is automatically integrated in the repository flow.
IRepository<User> repository;
The same is valid for ICommand and IQuery.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Rystem.RepositoryFramework.Abstractions (>= 3.0.18)
- Scrutor (>= 4.2.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rystem.RepositoryFramework.Cache:
Package | Downloads |
---|---|
Rystem.RepositoryFramework.Cache.Azure.Storage.Blob
Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 54,055 | 11/16/2024 |
9.0.0-rc.1 | 76 | 10/18/2024 |
6.2.0 | 219,034 | 10/9/2024 |
6.1.1 | 99 | 10/9/2024 |
6.1.0 | 47,848 | 9/29/2024 |
6.0.24 | 114 | 9/11/2024 |
6.0.23 | 106 | 7/18/2024 |
6.0.21 | 122 | 6/18/2024 |
6.0.20 | 120 | 6/16/2024 |
6.0.19 | 114 | 6/14/2024 |
6.0.18 | 108 | 6/14/2024 |
6.0.17 | 106 | 6/14/2024 |
6.0.16 | 103 | 6/10/2024 |
6.0.15 | 122 | 6/9/2024 |
6.0.14 | 122 | 5/24/2024 |
6.0.13 | 121 | 5/23/2024 |
6.0.12 | 111 | 5/23/2024 |
6.0.11 | 130 | 5/20/2024 |
6.0.9 | 137 | 5/20/2024 |
6.0.7 | 120 | 5/18/2024 |
6.0.6 | 111 | 5/10/2024 |
6.0.5 | 123 | 5/10/2024 |
6.0.4 | 159 | 4/3/2024 |
6.0.3 | 1,327 | 3/25/2024 |
6.0.2 | 186 | 3/11/2024 |
6.0.0 | 1,005 | 11/21/2023 |
6.0.0-rc.6 | 110 | 10/25/2023 |
6.0.0-rc.5 | 80 | 10/25/2023 |
6.0.0-rc.4 | 73 | 10/23/2023 |
6.0.0-rc.3 | 69 | 10/19/2023 |
6.0.0-rc.2 | 79 | 10/18/2023 |
6.0.0-rc.1 | 82 | 10/16/2023 |
5.0.20 | 518 | 9/25/2023 |
5.0.19 | 512 | 9/10/2023 |
5.0.18 | 495 | 9/6/2023 |
5.0.17 | 475 | 9/6/2023 |
5.0.16 | 552 | 9/5/2023 |
5.0.15 | 498 | 9/5/2023 |
5.0.14 | 494 | 9/5/2023 |
5.0.13 | 489 | 9/1/2023 |
5.0.12 | 462 | 8/31/2023 |
5.0.11 | 491 | 8/30/2023 |
5.0.10 | 518 | 8/29/2023 |
5.0.9 | 498 | 8/24/2023 |
5.0.8 | 507 | 8/24/2023 |
5.0.7 | 513 | 8/23/2023 |
5.0.6 | 543 | 8/21/2023 |
5.0.5 | 523 | 8/21/2023 |
5.0.4 | 552 | 8/16/2023 |
5.0.3 | 615 | 8/2/2023 |
5.0.2 | 571 | 8/2/2023 |
5.0.1 | 597 | 8/1/2023 |
5.0.0 | 599 | 7/31/2023 |
4.1.26 | 626 | 7/20/2023 |
4.1.25 | 592 | 7/16/2023 |
4.1.24 | 705 | 6/13/2023 |
4.1.23 | 613 | 6/13/2023 |
4.1.22 | 1,013 | 5/30/2023 |
4.1.21 | 606 | 5/20/2023 |
4.1.20 | 315,635 | 4/19/2023 |
4.1.19 | 95,555 | 3/20/2023 |
4.1.18 | 715 | 3/20/2023 |
4.1.17 | 690 | 3/16/2023 |
4.1.16 | 695 | 3/16/2023 |
4.1.15 | 689 | 3/15/2023 |
4.1.14 | 1,777 | 3/9/2023 |
4.1.13 | 716 | 3/7/2023 |
4.1.12 | 866 | 2/10/2023 |
4.1.11 | 745 | 1/26/2023 |
4.1.10 | 760 | 1/22/2023 |
4.1.9 | 732 | 1/20/2023 |
4.1.8 | 745 | 1/18/2023 |
4.1.7 | 733 | 1/18/2023 |
4.1.6 | 747 | 1/17/2023 |
4.1.1 | 780 | 1/4/2023 |
4.1.0 | 780 | 1/1/2023 |
3.1.5 | 760 | 12/21/2022 |
3.1.3 | 767 | 12/12/2022 |
3.1.2 | 750 | 12/7/2022 |
3.1.1 | 764 | 12/7/2022 |
3.1.0 | 822 | 12/2/2022 |
3.0.29 | 756 | 12/1/2022 |
3.0.28 | 779 | 12/1/2022 |
3.0.27 | 820 | 11/23/2022 |
3.0.25 | 884 | 11/23/2022 |
3.0.24 | 885 | 11/18/2022 |
3.0.23 | 878 | 11/18/2022 |
3.0.22 | 880 | 11/15/2022 |
3.0.21 | 872 | 11/14/2022 |
3.0.20 | 910 | 11/13/2022 |
3.0.19 | 1,014 | 11/2/2022 |
3.0.18 | 883 | 11/2/2022 |
3.0.17 | 937 | 10/29/2022 |
3.0.16 | 938 | 10/29/2022 |
3.0.15 | 925 | 10/29/2022 |
3.0.14 | 1,067 | 10/24/2022 |
3.0.13 | 947 | 10/24/2022 |
3.0.12 | 937 | 10/17/2022 |
3.0.11 | 983 | 10/10/2022 |
3.0.10 | 982 | 10/6/2022 |
3.0.9 | 972 | 10/6/2022 |
3.0.8 | 965 | 10/6/2022 |
3.0.7 | 903 | 10/6/2022 |
3.0.6 | 973 | 10/5/2022 |
3.0.5 | 850 | 10/5/2022 |
3.0.4 | 986 | 10/5/2022 |
3.0.3 | 964 | 10/3/2022 |
3.0.2 | 955 | 9/30/2022 |
3.0.1 | 971 | 9/30/2022 |
2.0.17 | 856 | 9/29/2022 |
2.0.16 | 996 | 9/27/2022 |
2.0.15 | 1,046 | 9/27/2022 |
2.0.14 | 1,034 | 9/26/2022 |
2.0.13 | 994 | 9/26/2022 |
2.0.12 | 991 | 9/26/2022 |
2.0.11 | 1,018 | 9/25/2022 |
2.0.10 | 1,065 | 9/25/2022 |
2.0.9 | 1,030 | 9/22/2022 |
2.0.8 | 984 | 9/22/2022 |
2.0.6 | 1,017 | 9/20/2022 |
2.0.5 | 1,149 | 9/20/2022 |
2.0.4 | 991 | 9/20/2022 |
2.0.2 | 1,016 | 9/20/2022 |
2.0.1 | 1,068 | 9/13/2022 |
2.0.0 | 983 | 8/19/2022 |
1.1.24 | 1,077 | 7/30/2022 |
1.1.23 | 1,049 | 7/29/2022 |
1.1.22 | 898 | 7/29/2022 |
1.1.21 | 1,012 | 7/29/2022 |
1.1.20 | 1,026 | 7/29/2022 |
1.1.19 | 1,030 | 7/27/2022 |
1.1.17 | 1,083 | 7/27/2022 |
1.1.16 | 1,004 | 7/26/2022 |
1.1.15 | 1,026 | 7/25/2022 |
1.1.14 | 1,023 | 7/25/2022 |
1.1.13 | 1,007 | 7/22/2022 |
1.1.12 | 1,043 | 7/19/2022 |
1.1.11 | 1,034 | 7/19/2022 |
1.1.10 | 996 | 7/19/2022 |
1.1.9 | 1,034 | 7/19/2022 |
1.1.8 | 1,064 | 7/18/2022 |
1.1.7 | 1,021 | 7/18/2022 |
1.1.6 | 1,023 | 7/18/2022 |
1.1.5 | 1,054 | 7/17/2022 |
1.1.4 | 905 | 7/17/2022 |
1.1.3 | 1,173 | 7/17/2022 |
1.1.2 | 1,024 | 7/17/2022 |
1.1.0 | 1,045 | 7/17/2022 |
1.0.2 | 1,006 | 7/15/2022 |
1.0.1 | 901 | 7/15/2022 |
1.0.0 | 1,047 | 7/8/2022 |
0.10.7 | 1,003 | 7/7/2022 |
0.10.2 | 1,036 | 7/2/2022 |
0.10.1 | 1,053 | 7/1/2022 |
0.10.0 | 931 | 7/1/2022 |
0.9.10 | 1,004 | 6/20/2022 |
0.9.9 | 1,009 | 6/11/2022 |
0.9.7 | 893 | 6/9/2022 |
0.9.6 | 918 | 6/9/2022 |