Skip to content

Commit 3b9bfb6

Browse files
claudiamurialdoBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:feat/hybrid-redis-cache' into beta
1 parent 2fb6c34 commit 3b9bfb6

File tree

1 file changed

+4
-4
lines changed
  • dotnet/src/dotnetframework/Providers/Cache/GxRedis

1 file changed

+4
-4
lines changed

dotnet/src/dotnetframework/Providers/Cache/GxRedis/GxRedis.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public Redis(string connectionString)
3737
{
3838
_redisConnectionOptions = ConfigurationOptions.Parse(connectionString);
3939
_redisConnectionOptions.AllowAdmin = true;
40-
InitLocalCache();
4140
}
4241

4342
public Redis(string connectionString, int sessionTimeout):this(connectionString)
@@ -80,13 +79,14 @@ public Redis()
8079
_redisConnectionOptions = ConfigurationOptions.Parse(address);
8180
}
8281
_redisConnectionOptions.AllowAdmin = true;
83-
InitLocalCache();
82+
InitLocalCache(providerService);
8483
}
8584
}
86-
private void InitLocalCache()
85+
private void InitLocalCache(GXService providerService)
8786
{
8887
#if NETCORE
89-
if (EnvVarReader.GetEnvironmentValue(GXServices.CACHE_SERVICE, GXServices.REDIS_CACHE_SERVICE, "HYBRID", out string envVarValue) && envVarValue.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase))
88+
string localCache = providerService.Properties.Get("ENABLE_MEMORY_CACHE");
89+
if (!string.IsNullOrEmpty(localCache) && localCache.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase))
9090
{
9191
GXLogging.Debug(log, "Using Redis Hybrid mode with local memory cache.");
9292
_localCache = new MemoryCache(new MemoryCacheOptions());

0 commit comments

Comments
 (0)