Rystem.RepositoryFramework.Cache 9.0.16

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Cache --version 9.0.16
                    
NuGet\Install-Package Rystem.RepositoryFramework.Cache -Version 9.0.16
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rystem.RepositoryFramework.Cache" Version="9.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.RepositoryFramework.Cache" Version="9.0.16" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.RepositoryFramework.Cache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rystem.RepositoryFramework.Cache --version 9.0.16
                    
#r "nuget: Rystem.RepositoryFramework.Cache, 9.0.16"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rystem.RepositoryFramework.Cache@9.0.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rystem.RepositoryFramework.Cache&version=9.0.16
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.RepositoryFramework.Cache&version=9.0.16
                    
Install as a Cake Tool

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 Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.2 261,762 5/29/2025
9.1.1 97,817 5/2/2025
9.0.32 186,638 4/15/2025
9.0.31 5,708 4/2/2025
9.0.30 88,711 3/26/2025
9.0.29 8,929 3/18/2025
9.0.28 166 3/17/2025
9.0.27 166 3/16/2025
9.0.26 176 3/13/2025
9.0.25 52,040 3/9/2025
9.0.21 649 3/6/2025
9.0.20 19,505 3/6/2025
9.0.19 233 3/6/2025
9.0.18 236 3/4/2025
9.0.17 121 3/1/2025
9.0.16 123 3/1/2025
9.0.15 75,481 2/22/2025
9.0.14 22,500 2/18/2025
9.0.13 140 2/9/2025
9.0.12 217,913 1/13/2025
9.0.11 23,959 1/9/2025
9.0.10 74 1/9/2025
9.0.9 3,979 1/7/2025
9.0.8 12,474 1/6/2025
9.0.7 116 1/6/2025
9.0.4 92,256 12/23/2024
9.0.3 157 12/22/2024
9.0.2 10,689 12/21/2024
9.0.1 1,165 12/21/2024
9.0.0 172,937 11/16/2024
9.0.0-rc.1 95 10/18/2024
6.2.0 219,075 10/9/2024
6.1.1 138 10/9/2024
6.1.0 47,897 9/29/2024
6.0.24 155 9/11/2024
6.0.23 145 7/18/2024
6.0.21 162 6/18/2024
6.0.20 157 6/16/2024
6.0.19 152 6/14/2024
6.0.18 146 6/14/2024
6.0.17 144 6/14/2024
6.0.16 137 6/10/2024
6.0.15 157 6/9/2024
6.0.14 159 5/24/2024
6.0.13 157 5/23/2024
6.0.12 144 5/23/2024
6.0.11 169 5/20/2024
6.0.9 173 5/20/2024
6.0.7 154 5/18/2024
6.0.6 152 5/10/2024
6.0.5 168 5/10/2024
6.0.4 206 4/3/2024
6.0.3 1,591 3/25/2024
6.0.2 219 3/11/2024
6.0.0 1,023 11/21/2023
6.0.0-rc.6 125 10/25/2023
6.0.0-rc.5 97 10/25/2023
6.0.0-rc.4 89 10/23/2023
6.0.0-rc.3 89 10/19/2023
6.0.0-rc.2 96 10/18/2023
6.0.0-rc.1 99 10/16/2023
5.0.20 540 9/25/2023
5.0.19 536 9/10/2023
5.0.18 523 9/6/2023
5.0.17 500 9/6/2023
5.0.16 578 9/5/2023
5.0.15 525 9/5/2023
5.0.14 522 9/5/2023
5.0.13 515 9/1/2023
5.0.12 487 8/31/2023
5.0.11 516 8/30/2023
5.0.10 555 8/29/2023
5.0.9 525 8/24/2023
5.0.8 534 8/24/2023
5.0.7 555 8/23/2023
5.0.6 595 8/21/2023
5.0.5 550 8/21/2023
5.0.4 578 8/16/2023
5.0.3 644 8/2/2023
5.0.2 597 8/2/2023
5.0.1 625 8/1/2023
5.0.0 628 7/31/2023
4.1.26 656 7/20/2023
4.1.25 620 7/16/2023
4.1.24 740 6/13/2023
4.1.23 649 6/13/2023
4.1.22 1,062 5/30/2023
4.1.21 643 5/20/2023
4.1.20 315,674 4/19/2023
4.1.19 95,591 3/20/2023
4.1.18 762 3/20/2023
4.1.17 724 3/16/2023
4.1.16 733 3/16/2023
4.1.15 725 3/15/2023
4.1.14 1,815 3/9/2023
4.1.13 752 3/7/2023
4.1.12 905 2/10/2023
4.1.11 786 1/26/2023
4.1.10 803 1/22/2023
4.1.9 775 1/20/2023
4.1.8 785 1/18/2023
4.1.7 778 1/18/2023
4.1.6 790 1/17/2023
4.1.1 821 1/4/2023
4.1.0 820 1/1/2023
3.1.5 799 12/21/2022
3.1.3 807 12/12/2022
3.1.2 791 12/7/2022
3.1.1 804 12/7/2022
3.1.0 866 12/2/2022
3.0.29 801 12/1/2022
3.0.28 821 12/1/2022
3.0.27 864 11/23/2022
3.0.25 929 11/23/2022
3.0.24 940 11/18/2022
3.0.23 921 11/18/2022
3.0.22 927 11/15/2022
3.0.21 915 11/14/2022
3.0.20 954 11/13/2022
3.0.19 1,059 11/2/2022
3.0.18 926 11/2/2022
3.0.17 981 10/29/2022
3.0.16 981 10/29/2022
3.0.15 969 10/29/2022
3.0.14 1,111 10/24/2022
3.0.13 990 10/24/2022
3.0.12 986 10/17/2022
3.0.11 1,029 10/10/2022
3.0.10 1,026 10/6/2022
3.0.9 1,017 10/6/2022
3.0.8 1,021 10/6/2022
3.0.7 956 10/6/2022
3.0.6 1,019 10/5/2022
3.0.5 895 10/5/2022
3.0.4 1,033 10/5/2022
3.0.3 1,010 10/3/2022
3.0.2 1,007 9/30/2022
3.0.1 1,017 9/30/2022
2.0.17 910 9/29/2022
2.0.16 1,052 9/27/2022
2.0.15 1,089 9/27/2022
2.0.14 1,078 9/26/2022
2.0.13 1,038 9/26/2022
2.0.12 1,037 9/26/2022
2.0.11 1,062 9/25/2022
2.0.10 1,109 9/25/2022
2.0.9 1,074 9/22/2022
2.0.8 1,029 9/22/2022
2.0.6 1,061 9/20/2022
2.0.5 1,202 9/20/2022
2.0.4 1,034 9/20/2022
2.0.2 1,060 9/20/2022
2.0.1 1,114 9/13/2022
2.0.0 1,026 8/19/2022
1.1.24 1,126 7/30/2022
1.1.23 1,095 7/29/2022
1.1.22 946 7/29/2022
1.1.21 1,058 7/29/2022
1.1.20 1,083 7/29/2022
1.1.19 1,080 7/27/2022
1.1.17 1,130 7/27/2022
1.1.16 1,052 7/26/2022
1.1.15 1,074 7/25/2022
1.1.14 1,070 7/25/2022
1.1.13 1,056 7/22/2022
1.1.12 1,091 7/19/2022
1.1.11 1,081 7/19/2022
1.1.10 1,045 7/19/2022
1.1.9 1,084 7/19/2022
1.1.8 1,113 7/18/2022
1.1.7 1,068 7/18/2022
1.1.6 1,071 7/18/2022
1.1.5 1,102 7/17/2022
1.1.4 954 7/17/2022
1.1.3 1,220 7/17/2022
1.1.2 1,072 7/17/2022
1.1.0 1,099 7/17/2022
1.0.2 1,053 7/15/2022
1.0.1 950 7/15/2022
1.0.0 1,093 7/8/2022
0.10.7 1,060 7/7/2022
0.10.2 1,082 7/2/2022
0.10.1 1,101 7/1/2022
0.10.0 981 7/1/2022
0.9.10 1,052 6/20/2022
0.9.9 1,061 6/11/2022
0.9.7 944 6/9/2022
0.9.6 968 6/9/2022