diff --git a/Readme.md b/Readme.md
index 44ef36f..dc3740f 100644
--- a/Readme.md
+++ b/Readme.md
@@ -138,8 +138,11 @@ builder
.AddMediatrWithBehaviors(AssemblyRegistry.ToArray())
.AddResilienceDefaultPipeline()
.MapDefaultTimeZone()
- .AddDistributedFusionCache("redis://localhost:6379",
- builder.Environment.GetShortEnvironmentName() + "_" + "app_name") // or .AddFusionCache(...)
+ .AddDistributedCache(o =>
+ {
+ o.RedisConnectionString = "redis://localhost:6379";
+ o.ChannelPrefix = "app_name:";
+ })
.AddDistributedSignalR("redis://localhost:6379","app_name:") // or .AddSignalR()
.AddCors()
.AddHealthChecks();
@@ -622,7 +625,6 @@ This package includes various extensions and utilities to aid development:
retrieves DefaultTimeZone from `appsettings.json` and sets it as the default time zone.
- **UrlBuilder:** A utility for building URLs with query parameters.
- **Language ISO Code Helper:** Validate, query, and retrieve information about ISO language codes.
-- **FusionCache Extensions:** Simplify the configuration of in memory or distributed caching with Redis.
### Related NuGet Packages
@@ -630,6 +632,7 @@ This package includes various extensions and utilities to aid development:
- **Pandatech.FluentMinimalApiMapper:** Simplifies mapping in minimal APIs.
- **Pandatech.RegexBox:** A collection of useful regular expressions.
- **Pandatech.ResponseCrafter:** A utility for crafting consistent API responses.
+- **Pandatech.DistributedCache:** A distributed cache provider for Redis.
## License
diff --git a/Shared.Kernel.Demo/Program.cs b/Shared.Kernel.Demo/Program.cs
index 8687d18..925251e 100644
--- a/Shared.Kernel.Demo/Program.cs
+++ b/Shared.Kernel.Demo/Program.cs
@@ -1,3 +1,4 @@
+using DistributedCache.Extensions;
using DistributedCache.Options;
using FluentMinimalApiMapper;
using Microsoft.AspNetCore.Mvc;
@@ -26,9 +27,12 @@
.AddControllers(AssemblyRegistry.ToArray())
.AddMediatrWithBehaviors(AssemblyRegistry.ToArray())
.AddResilienceDefaultPipeline()
- .AddDistributedFusionCache("redis://localhost:6379",
- builder.Environment.GetShortEnvironmentName() + "_" + "app_name") // or .AddFusionCache(...)
- .AddDistributedSignalR("redis://localhost:6379","app_name:") // or .AddSignalR()
+ .AddDistributedSignalR("redis://localhost:6379", "app_name:") // or .AddSignalR()
+ .AddDistributedCache(o =>
+ {
+ o.RedisConnectionString = "redis://localhost:6379";
+ o.ChannelPrefix = "app_name:";
+ })
.MapDefaultTimeZone()
.AddCors()
.AddOutboundLoggingHandler()
diff --git a/src/SharedKernel/Extensions/DistributedCacheExtension.cs b/src/SharedKernel/Extensions/DistributedCacheExtension.cs
deleted file mode 100644
index 5094cba..0000000
--- a/src/SharedKernel/Extensions/DistributedCacheExtension.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using DistributedCache.Extensions;
-using DistributedCache.Options;
-using Microsoft.AspNetCore.Builder;
-
-namespace SharedKernel.Extensions;
-
-public static class DistributedCacheExtension
-{
- public static WebApplicationBuilder AddRedis(this WebApplicationBuilder builder, KeyPrefix keyPrefix)
- {
- builder.AddDistributedCache(options =>
- {
- options.RedisConnectionString = builder.Configuration.GetRedisUrl();
- options.KeyPrefixForIsolation = keyPrefix;
- });
-
- return builder;
- }
-}
\ No newline at end of file
diff --git a/src/SharedKernel/Extensions/FusionCacheExtensions.cs b/src/SharedKernel/Extensions/FusionCacheExtensions.cs
index e669e7f..01aaec4 100644
--- a/src/SharedKernel/Extensions/FusionCacheExtensions.cs
+++ b/src/SharedKernel/Extensions/FusionCacheExtensions.cs
@@ -1,42 +1,42 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.Caching.StackExchangeRedis;
-using Microsoft.Extensions.DependencyInjection;
-using ZiggyCreatures.Caching.Fusion;
-
-namespace SharedKernel.Extensions;
-
-public static class FusionCacheExtensions
-{
- private static IFusionCacheBuilder AddBaseFusionCache(WebApplicationBuilder builder, string instanceName)
- {
- return builder.Services
- .AddFusionCache()
- .WithRegisteredLogger()
- .WithNeueccMessagePackSerializer()
- .WithDefaultEntryOptions(new FusionCacheEntryOptions())
- .WithCacheKeyPrefix(instanceName);
- }
-
-
- public static WebApplicationBuilder AddDistributedFusionCache(this WebApplicationBuilder builder,
- string redisUrl,
- string instanceName)
- {
- AddBaseFusionCache(builder, instanceName)
- .WithDistributedCache(new RedisCache(new RedisCacheOptions
- {
- Configuration = redisUrl,
- InstanceName = instanceName
- }))
- .WithStackExchangeRedisBackplane(o => o.Configuration = redisUrl)
- .AsHybridCache();
-
- return builder;
- }
-
- public static WebApplicationBuilder AddFusionCache(this WebApplicationBuilder builder, string instanceName)
- {
- AddBaseFusionCache(builder, instanceName);
- return builder;
- }
-}
\ No newline at end of file
+// using Microsoft.AspNetCore.Builder;
+// using Microsoft.Extensions.Caching.StackExchangeRedis;
+// using Microsoft.Extensions.DependencyInjection;
+// using ZiggyCreatures.Caching.Fusion;
+//
+// namespace SharedKernel.Extensions;
+//
+// public static class FusionCacheExtensions
+// {
+// private static IFusionCacheBuilder AddBaseFusionCache(WebApplicationBuilder builder, string instanceName)
+// {
+// return builder.Services
+// .AddFusionCache()
+// .WithRegisteredLogger()
+// .WithNeueccMessagePackSerializer()
+// .WithDefaultEntryOptions(new FusionCacheEntryOptions())
+// .WithCacheKeyPrefix(instanceName)
+// .AsHybridCache();
+// }
+//
+//
+// public static WebApplicationBuilder AddDistributedFusionCache(this WebApplicationBuilder builder,
+// string redisUrl,
+// string instanceName)
+// {
+// AddBaseFusionCache(builder, instanceName)
+// .WithDistributedCache(new RedisCache(new RedisCacheOptions
+// {
+// Configuration = redisUrl,
+// InstanceName = instanceName
+// }))
+// .WithStackExchangeRedisBackplane(o => o.Configuration = redisUrl);
+//
+// return builder;
+// }
+//
+// public static WebApplicationBuilder AddFusionCache(this WebApplicationBuilder builder, string instanceName)
+// {
+// AddBaseFusionCache(builder, instanceName);
+// return builder;
+// }
+// }
\ No newline at end of file
diff --git a/src/SharedKernel/Extensions/OpenTelemetryExtension.cs b/src/SharedKernel/Extensions/OpenTelemetryExtension.cs
index 5bb98a7..6583878 100644
--- a/src/SharedKernel/Extensions/OpenTelemetryExtension.cs
+++ b/src/SharedKernel/Extensions/OpenTelemetryExtension.cs
@@ -27,7 +27,7 @@ public static WebApplicationBuilder AddOpenTelemetry(this WebApplicationBuilder
.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation()
- .AddFusionCacheInstrumentation()
+ // .AddFusionCacheInstrumentation()
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddPrometheusExporter();
@@ -35,7 +35,7 @@ public static WebApplicationBuilder AddOpenTelemetry(this WebApplicationBuilder
.WithTracing(tracing =>
{
tracing
- .AddFusionCacheInstrumentation()
+ // .AddFusionCacheInstrumentation()
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddEntityFrameworkCoreInstrumentation();
diff --git a/src/SharedKernel/SharedKernel.csproj b/src/SharedKernel/SharedKernel.csproj
index e82fbfe..7866375 100644
--- a/src/SharedKernel/SharedKernel.csproj
+++ b/src/SharedKernel/SharedKernel.csproj
@@ -8,13 +8,13 @@