소스 검색

初始化redis

lcl 5 달 전
부모
커밋
1edf0e2bc7
2개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 0 4
      AppStart/Redis/RedisDbconn.cs
  2. 3 0
      Startup.cs

+ 0 - 4
AppStart/Redis/RedisDbconn.cs

@@ -14,10 +14,6 @@ namespace MySystem
         public static CSRedis.CSRedisClient csredis;
         public static CSRedis.CSRedisClient csredis;
         private RedisDbconn()
         private RedisDbconn()
         {
         {
-            if (csredis == null)
-            {
-                csredis = new CSRedis.CSRedisClient(ConfigurationManager.AppSettings["RedisConnStr"].ToString());
-            }
         }
         }
 
 
         #region 设置单个字段
         #region 设置单个字段

+ 3 - 0
Startup.cs

@@ -102,6 +102,9 @@ namespace MySystem
             //services.AddHttpContextAccessor();
             //services.AddHttpContextAccessor();
 
 
             MySystemLib.SystemPublicFuction.appcheck = "success";
             MySystemLib.SystemPublicFuction.appcheck = "success";
+
+            RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
+            KxsRedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:KxsRedisConnStr"]);
         }
         }
 
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.