Aj.DCache
1.0.34
dotnet add package Aj.DCache --version 1.0.34
NuGet\Install-Package Aj.DCache -Version 1.0.34
<PackageReference Include="Aj.DCache" Version="1.0.34" />
<PackageVersion Include="Aj.DCache" Version="1.0.34" />
<PackageReference Include="Aj.DCache" />
paket add Aj.DCache --version 1.0.34
#r "nuget: Aj.DCache, 1.0.34"
#:package Aj.DCache@1.0.34
#addin nuget:?package=Aj.DCache&version=1.0.34
#tool nuget:?package=Aj.DCache&version=1.0.34
Aj.DCache
🚀 Aj.DCache é uma biblioteca .NET para gerenciamento de cache distribuído, construída sobre DragonflyDB (compatível com Redis) e projetada para ser segura, escalável e fácil de integrar em ambientes de alta concorrência.
✨ Funcionalidades
- Suporte completo ao protocolo Redis, DragonflyDB e KeyDB
- Operações padrão de cache distribuído (get/set/remove)
- Suporte ao padrão Lazy Caching (
GetOrCreate) - Evita duplicidade com
SETNX(gravação segura) - Integração simples com
ILogger(compatível com Serilog) - Preparado para lock distribuído usando RedLock
- Estrutura enxuta e amigável para múltiplos projetos .NET
- 100% thread-safe
- Preparado para uso em multi-tenancy
📦 Instalação
via NuGet:
dotnet add package Aj.DCache
🚀 Primeiros passos
Configure no Program.cs ou Startup.cs:
builder.Services.AddAjDCacheServices(configuration);
Exemplo de uso do cache:
var result = await DistributedCacheHelper.GetOrCreateAsync<MyObject>(
key: "meu-cache",
factory: async () => await ObterDoBanco(),
expiration: TimeSpan.FromMinutes(5)
);
⚙️ Configuração do Redis / Dragonfly
No seu appsettings.json:
"AjDCacheOptions": {
"Server": "localhost:6379,password=suasenha",
"Environment": "Production",
"ExpirationTimeout": 300,
"LockTimeout": 3,
"PollyRetryPolicy": 3,
"UseCompression": true,
"DataBaseId":
}
🛠️ Dependências
✅ Roadmap
- Implementar lock distribuído (Redlock)
- Suporte a cluster multi-node
- Benchmarks comparativos
- Documentação avançada
- Melhorias no suporte a multi-tenancy
🤝 Contribuindo
Pull requests são muito bem-vindos! Abra uma issue ou envie sugestões para evoluirmos juntos.
📄 Licença
🎯 Baixe o arquivo pronto no link abaixo:
Estrutra do Projeto
Aj.DCache
│
├── Configuration
│ └── AjDCacheOptions.cs
│
├── Extensions
│ └── MemoryCacheExtensions.cs
│
├── Helpers
│ └── CompressionHelper.cs
│ └── DistributedLockHelper.cs
│
├── Interfaces
│ └── IAjMemoryCache.cs
│
├── Model
│ └── CacheEntry.cs
│
├── Providers
│ └── AjMemoryCache.cs
│ └── DistributedCacheProvider.cs
│
└── Services
└── RedisCacheService.cs
Resumo
Interfaces → apenas contratos (IAjMemoryCache, ILockProvider, etc)
Providers → implementações concretas desses contratos
Services → serviços de alto nível que coordenam regras
Helpers → utilitários
Extensions → métodos de extensão
Model → DTOs/POCOs
| Product | Versions 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. |
-
net9.0
- AsyncKeyedLock (>= 8.0.2)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Caching.Memory (>= 10.0.5)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.6)
- RedLock.net (>= 2.3.2)
- Serilog (>= 4.3.1)
- Serilog.Sinks.Console (>= 6.1.1)
- StackExchange.Redis (>= 2.13.17)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Aj.DCache:
| Package | Downloads |
|---|---|
|
Aj.RabbitMQ.Core
Biblioteca .NET moderna para facilitar a integração de aplicações e microsserviços com RabbitMQ, incluindo suporte a padrões de Retry, Dead-Letter Queue, multi-tenant e envelopes padronizados de mensagens. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.34 | 138 | 6/5/2026 |
| 1.0.33 | 830 | 4/24/2026 |
| 1.0.32 | 794 | 3/20/2026 |
| 1.0.31 | 421 | 3/20/2026 |
| 1.0.30 | 509 | 3/11/2026 |
| 1.0.29 | 611 | 2/23/2026 |
| 1.0.28 | 1,084 | 1/26/2026 |
| 1.0.27 | 475 | 1/25/2026 |
| 1.0.26 | 465 | 1/25/2026 |
| 1.0.25 | 1,008 | 1/14/2026 |
| 1.0.24 | 499 | 1/14/2026 |
| 1.0.23 | 516 | 1/13/2026 |
| 1.0.22 | 477 | 1/13/2026 |
| 1.0.21 | 563 | 1/2/2026 |
| 1.0.20 | 553 | 11/26/2025 |
| 1.0.19 | 187 | 11/26/2025 |
| 1.0.18 | 199 | 11/24/2025 |
| 1.0.17 | 320 | 11/8/2025 |
| 1.0.16 | 301 | 11/4/2025 |
| 1.0.15 | 207 | 11/3/2025 |
Versão inicial do Aj.DCache com suporte a MemoryCache Local, Redis e DistributedCache Hibrido.