Simplify.Cache.Proxy.Extensions
1.0.9
dotnet add package Simplify.Cache.Proxy.Extensions --version 1.0.9
NuGet\Install-Package Simplify.Cache.Proxy.Extensions -Version 1.0.9
<PackageReference Include="Simplify.Cache.Proxy.Extensions" Version="1.0.9" />
<PackageVersion Include="Simplify.Cache.Proxy.Extensions" Version="1.0.9" />
<PackageReference Include="Simplify.Cache.Proxy.Extensions" />
paket add Simplify.Cache.Proxy.Extensions --version 1.0.9
#r "nuget: Simplify.Cache.Proxy.Extensions, 1.0.9"
#:package Simplify.Cache.Proxy.Extensions@1.0.9
#addin nuget:?package=Simplify.Cache.Proxy.Extensions&version=1.0.9
#tool nuget:?package=Simplify.Cache.Proxy.Extensions&version=1.0.9
Simplify.Cache.Proxy
<p align="center"> <img src="assets/redis-cache-proxy.svg" alt="Redis Cache Proxy logo" width="200" /> </p>
Biblioteca reutilizável que demonstra como encapsular repositórios atrás de um DispatchProxy com Redis. O repositório agora mantém apenas dois projetos:
src/Simplify.Cache.Proxy/→ pacote multi-target (namespaceSimplify.Cache.Proxy) pronto para o NuGet.tests/Simplify.Cache.Proxy.Tests/→ suíte de testes em xUnit (namespaceSimplify.Cache.Proxy.Tests) que valida o comportamento público da extensão.
Simplify.Cache.Proxy
Principais recursos
[RedisCached]para definir TTL por repositório (mínimo de 30 min).AddRedisCacheProxyregistraIConnectionMultiplexervia connection string ou factory customizada.AddRedisCachedRepository<TInterface, TImplementation>()decora a implementação concreta com umDispatchProxyque lê/escreve em Redis.RedisCachingProxyserializa comSystem.Text.Jsone gera chaves determinísticas para expressões LINQ (ExpressionExtensions+KeyExpressionVisitor).- Multi-target (
netstandard2.0,net6.0,net7.0,net8.0) incluindo README e ícone no pacote.
Instalação (NuGet)
dotnet add package Simplify.Cache.Proxy.Extensions
Uso típico
services.AddRedisCacheProxy("localhost:6379");
services.AddRedisCachedRepository<ICustomerRepository, CustomerRepository>(
defaultExpiration: TimeSpan.FromMinutes(30));
[RedisCached(expirationInMinutes: 5)]
internal sealed class CustomerRepository : ICustomerRepository
{
// ...
}
Fluxo de desenvolvimento
Requisitos
Restaurar, compilar e testar
dotnet restore Simplify.Cache.Proxy.sln
dotnet build Simplify.Cache.Proxy.sln -c Release
dotnet test Simplify.Cache.Proxy.sln
Empacotar a extensão
dotnet pack src/Simplify.Cache.Proxy/Simplify.Cache.Proxy.csproj \
-c Release -o ./artifacts
Estratégia de testes
Os testes vivem em tests/Simplify.Cache.Proxy.Tests (xUnit + FluentAssertions + NSubstitute) e cobrem:
- Geração de chaves para expressões diferentes.
- Cache miss/hit para métodos async/sync.
- Aplicação correta das políticas de expiração (atributo vs.
defaultExpiration). - Registro via
IServiceCollectione injeção deIConnectionMultiplexer.
Execute dotnet test antes de qualquer PR e ao ajustar os cenários listados acima.
Publicação no NuGet
- Workflow (
.github/workflows/publish-extensions.yml) continua responsável por empacotar e publicar. - Dispare com tags
extensions-v*(ex.:extensions-v1.0.7) ou manualmente via GitHub Actions. - Confirme
dotnet packlocalmente, atualize<VersionPrefix>e mantenha README/ícones sincronizados antes de publicar.
Contribuindo
- Fork/branch (
git checkout -b feature/nome). - Implemente a mudança, acrescente testes pertinentes.
- Rode
dotnet build+dotnet test. - Commit (
git commit -am 'feat: descrição') e push. - Abra o PR descrevendo impactos no pacote.
O objetivo é manter uma extensão enxuta, multi-target e bem testada para quem deseja reutilizar proxies de cache com Redis em seus próprios repositórios.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. 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 is compatible. 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 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. net9.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- StackExchange.Redis (>= 2.7.33)
- System.Reflection.DispatchProxy (>= 4.7.1)
- System.Text.Json (>= 8.0.5)
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- StackExchange.Redis (>= 2.7.33)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- StackExchange.Redis (>= 2.7.33)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- StackExchange.Redis (>= 2.7.33)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.9 | 157 | 11/15/2025 |
Initial release of the Simplify Cache Proxy extensions extracted from the sample project.