Rystem.RepositoryFramework.Cache
6.0.0-rc.5
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Cache --version 6.0.0-rc.5
NuGet\Install-Package Rystem.RepositoryFramework.Cache -Version 6.0.0-rc.5
<PackageReference Include="Rystem.RepositoryFramework.Cache" Version="6.0.0-rc.5" />
paket add Rystem.RepositoryFramework.Cache --version 6.0.0-rc.5
#r "nuget: Rystem.RepositoryFramework.Cache, 6.0.0-rc.5"
// Install Rystem.RepositoryFramework.Cache as a Cake Addin #addin nuget:?package=Rystem.RepositoryFramework.Cache&version=6.0.0-rc.5&prerelease // Install Rystem.RepositoryFramework.Cache as a Cake Tool #tool nuget:?package=Rystem.RepositoryFramework.Cache&version=6.0.0-rc.5&prerelease
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}_{FactoryName}_{filter.ToKey()}";
Operation → operation will be cached with this key
var keyAsString = $"{nameof(RepositoryMethods.Operation)}_{operation.Name}_{typeof(T).Name}_{FactoryName}_{filter.ToKey()}";
Get → query will be cached with this key
var keyAsString = $"{nameof(RepositoryMethods.Get)}_{typeof(T).Name}_{FactoryName}_{key.AsString()}";
Exist → query will be cached with this key
var keyAsString = $"{nameof(RepositoryMethod.Exist)}_{typeof(T).Name}_{FactoryName}_{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
services
.AddRepository<Plant, int>(settings =>
{
settings
.WithInMemory();
settings
.WithInMemoryCache(x =>
{
x.ExpiringTime = TimeSpan.FromSeconds(1);
x.Methods = RepositoryMethods.All;
});
});
Usage
You always will find the same interface. For instance
IRepository<Plant, int> repository
or if you added a query pattern or command pattern
IQuery<Plant, int> query
ICommand<Plant, int> 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.
.AddRepository<Country, CountryKey>(builder =>
{
builder
.WithInMemory(inMemoryBuilder =>
{
inMemoryBuilder
.PopulateWithRandomData(NumberOfEntries, NumberOfEntries);
});
builder
.WithDistributedCache(distributedCacheBuilder =>
{
distributedCacheBuilder.ExpiringTime = TimeSpan.FromSeconds(10);
});
});
or a mix of them
.AddRepository<Country, CountryKey>(builder =>
{
builder
.WithInMemory(inMemoryBuilder =>
{
inMemoryBuilder
.PopulateWithRandomData(NumberOfEntries, NumberOfEntries);
});
builder
.WithInMemoryCache(inMemoryCacheBuilder =>
{
inMemoryCacheBuilder.ExpiringTime = TimeSpan.FromSeconds(10);
})
.WithDistributedCache(distributedCacheBuilder =>
{
distributedCacheBuilder.ExpiringTime = TimeSpan.FromSeconds(10);
});
});
and as always you will use the standard interface that is automatically integrated in the repository flow.
IRepository<User, string> repository;
The same is valid for ICommand and IQuery.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0-rc.2.23479.6)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0-rc.2.23479.6)
- Rystem.RepositoryFramework.Abstractions (>= 6.0.0-rc.5)
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 | 147,377 | 11/16/2024 |
9.0.0-rc.1 | 78 | 10/18/2024 |
6.2.0 | 219,039 | 10/9/2024 |
6.1.1 | 104 | 10/9/2024 |
6.1.0 | 47,856 | 9/29/2024 |
6.0.24 | 119 | 9/11/2024 |
6.0.23 | 112 | 7/18/2024 |
6.0.21 | 130 | 6/18/2024 |
6.0.20 | 126 | 6/16/2024 |
6.0.19 | 120 | 6/14/2024 |
6.0.18 | 114 | 6/14/2024 |
6.0.17 | 116 | 6/14/2024 |
6.0.16 | 109 | 6/10/2024 |
6.0.15 | 128 | 6/9/2024 |
6.0.14 | 128 | 5/24/2024 |
6.0.13 | 129 | 5/23/2024 |
6.0.12 | 117 | 5/23/2024 |
6.0.11 | 136 | 5/20/2024 |
6.0.9 | 143 | 5/20/2024 |
6.0.7 | 126 | 5/18/2024 |
6.0.6 | 117 | 5/10/2024 |
6.0.5 | 129 | 5/10/2024 |
6.0.4 | 162 | 4/3/2024 |
6.0.3 | 1,415 | 3/25/2024 |
6.0.2 | 191 | 3/11/2024 |
6.0.0 | 1,011 | 11/21/2023 |
6.0.0-rc.6 | 111 | 10/25/2023 |
6.0.0-rc.5 | 82 | 10/25/2023 |
6.0.0-rc.4 | 75 | 10/23/2023 |
6.0.0-rc.3 | 71 | 10/19/2023 |
6.0.0-rc.2 | 81 | 10/18/2023 |
6.0.0-rc.1 | 83 | 10/16/2023 |
5.0.20 | 522 | 9/25/2023 |
5.0.19 | 516 | 9/10/2023 |
5.0.18 | 499 | 9/6/2023 |
5.0.17 | 479 | 9/6/2023 |
5.0.16 | 556 | 9/5/2023 |
5.0.15 | 502 | 9/5/2023 |
5.0.14 | 498 | 9/5/2023 |
5.0.13 | 493 | 9/1/2023 |
5.0.12 | 466 | 8/31/2023 |
5.0.11 | 495 | 8/30/2023 |
5.0.10 | 522 | 8/29/2023 |
5.0.9 | 502 | 8/24/2023 |
5.0.8 | 511 | 8/24/2023 |
5.0.7 | 533 | 8/23/2023 |
5.0.6 | 546 | 8/21/2023 |
5.0.5 | 527 | 8/21/2023 |
5.0.4 | 555 | 8/16/2023 |
5.0.3 | 618 | 8/2/2023 |
5.0.2 | 574 | 8/2/2023 |
5.0.1 | 600 | 8/1/2023 |
5.0.0 | 603 | 7/31/2023 |
4.1.26 | 629 | 7/20/2023 |
4.1.25 | 595 | 7/16/2023 |
4.1.24 | 708 | 6/13/2023 |
4.1.23 | 616 | 6/13/2023 |
4.1.22 | 1,016 | 5/30/2023 |
4.1.21 | 610 | 5/20/2023 |
4.1.20 | 315,639 | 4/19/2023 |
4.1.19 | 95,558 | 3/20/2023 |
4.1.18 | 718 | 3/20/2023 |
4.1.17 | 693 | 3/16/2023 |
4.1.16 | 698 | 3/16/2023 |
4.1.15 | 692 | 3/15/2023 |
4.1.14 | 1,780 | 3/9/2023 |
4.1.13 | 719 | 3/7/2023 |
4.1.12 | 872 | 2/10/2023 |
4.1.11 | 748 | 1/26/2023 |
4.1.10 | 763 | 1/22/2023 |
4.1.9 | 738 | 1/20/2023 |
4.1.8 | 748 | 1/18/2023 |
4.1.7 | 736 | 1/18/2023 |
4.1.6 | 751 | 1/17/2023 |
4.1.1 | 783 | 1/4/2023 |
4.1.0 | 783 | 1/1/2023 |
3.1.5 | 763 | 12/21/2022 |
3.1.3 | 770 | 12/12/2022 |
3.1.2 | 753 | 12/7/2022 |
3.1.1 | 770 | 12/7/2022 |
3.1.0 | 825 | 12/2/2022 |
3.0.29 | 760 | 12/1/2022 |
3.0.28 | 782 | 12/1/2022 |
3.0.27 | 823 | 11/23/2022 |
3.0.25 | 887 | 11/23/2022 |
3.0.24 | 888 | 11/18/2022 |
3.0.23 | 881 | 11/18/2022 |
3.0.22 | 883 | 11/15/2022 |
3.0.21 | 875 | 11/14/2022 |
3.0.20 | 913 | 11/13/2022 |
3.0.19 | 1,017 | 11/2/2022 |
3.0.18 | 886 | 11/2/2022 |
3.0.17 | 940 | 10/29/2022 |
3.0.16 | 941 | 10/29/2022 |
3.0.15 | 928 | 10/29/2022 |
3.0.14 | 1,070 | 10/24/2022 |
3.0.13 | 950 | 10/24/2022 |
3.0.12 | 940 | 10/17/2022 |
3.0.11 | 986 | 10/10/2022 |
3.0.10 | 985 | 10/6/2022 |
3.0.9 | 975 | 10/6/2022 |
3.0.8 | 972 | 10/6/2022 |
3.0.7 | 910 | 10/6/2022 |
3.0.6 | 980 | 10/5/2022 |
3.0.5 | 853 | 10/5/2022 |
3.0.4 | 989 | 10/5/2022 |
3.0.3 | 967 | 10/3/2022 |
3.0.2 | 958 | 9/30/2022 |
3.0.1 | 974 | 9/30/2022 |
2.0.17 | 859 | 9/29/2022 |
2.0.16 | 1,000 | 9/27/2022 |
2.0.15 | 1,049 | 9/27/2022 |
2.0.14 | 1,037 | 9/26/2022 |
2.0.13 | 997 | 9/26/2022 |
2.0.12 | 994 | 9/26/2022 |
2.0.11 | 1,021 | 9/25/2022 |
2.0.10 | 1,068 | 9/25/2022 |
2.0.9 | 1,033 | 9/22/2022 |
2.0.8 | 988 | 9/22/2022 |
2.0.6 | 1,020 | 9/20/2022 |
2.0.5 | 1,152 | 9/20/2022 |
2.0.4 | 994 | 9/20/2022 |
2.0.2 | 1,019 | 9/20/2022 |
2.0.1 | 1,071 | 9/13/2022 |
2.0.0 | 986 | 8/19/2022 |
1.1.24 | 1,080 | 7/30/2022 |
1.1.23 | 1,052 | 7/29/2022 |
1.1.22 | 901 | 7/29/2022 |
1.1.21 | 1,015 | 7/29/2022 |
1.1.20 | 1,029 | 7/29/2022 |
1.1.19 | 1,033 | 7/27/2022 |
1.1.17 | 1,086 | 7/27/2022 |
1.1.16 | 1,007 | 7/26/2022 |
1.1.15 | 1,029 | 7/25/2022 |
1.1.14 | 1,026 | 7/25/2022 |
1.1.13 | 1,010 | 7/22/2022 |
1.1.12 | 1,046 | 7/19/2022 |
1.1.11 | 1,037 | 7/19/2022 |
1.1.10 | 999 | 7/19/2022 |
1.1.9 | 1,037 | 7/19/2022 |
1.1.8 | 1,067 | 7/18/2022 |
1.1.7 | 1,024 | 7/18/2022 |
1.1.6 | 1,026 | 7/18/2022 |
1.1.5 | 1,057 | 7/17/2022 |
1.1.4 | 908 | 7/17/2022 |
1.1.3 | 1,176 | 7/17/2022 |
1.1.2 | 1,027 | 7/17/2022 |
1.1.0 | 1,048 | 7/17/2022 |
1.0.2 | 1,009 | 7/15/2022 |
1.0.1 | 904 | 7/15/2022 |
1.0.0 | 1,050 | 7/8/2022 |
0.10.7 | 1,006 | 7/7/2022 |
0.10.2 | 1,039 | 7/2/2022 |
0.10.1 | 1,056 | 7/1/2022 |
0.10.0 | 934 | 7/1/2022 |
0.9.10 | 1,007 | 6/20/2022 |
0.9.9 | 1,012 | 6/11/2022 |
0.9.7 | 896 | 6/9/2022 |
0.9.6 | 921 | 6/9/2022 |