Browse Source

redis config

xf 1 year ago
parent
commit
f99b37b8ac

+ 2 - 1
src/CallCenter.Api/StartupExtensions.cs

@@ -179,7 +179,8 @@ internal static class StartupExtensions
         //cache
         //cache
         services.AddCache(d =>
         services.AddCache(d =>
             {
             {
-                d.ConnectionString = configuration.GetConnectionString("Redis");
+                var cacheConfig = configuration.GetSection("Cache").Get<CacheOptions>();
+                cacheConfig.Adapt(d);
                 d.Prefix = "CallCenter";
                 d.Prefix = "CallCenter";
             });
             });
 
 

+ 6 - 0
src/CallCenter.Api/appsettings.Development.json

@@ -47,6 +47,12 @@
     "CallCenter": "server=110.188.24.182;Database=callcenter;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
     "CallCenter": "server=110.188.24.182;Database=callcenter;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
     "Redis": "110.188.24.182"
     "Redis": "110.188.24.182"
   },
   },
+  "Cache": {
+    "Host": "110.188.24.182",
+    "Port": 50179,
+    "Password": "fengwo22@@",
+    "Database": 2
+  },
   "Swagger": true,
   "Swagger": true,
   "Cors": {
   "Cors": {
     "Origins": [ "http://localhost:8888", "http://callcenter-admin.fengwo.com", "http://admin.call.fengwo.com" ]
     "Origins": [ "http://localhost:8888", "http://callcenter-admin.fengwo.com", "http://admin.call.fengwo.com" ]

+ 4 - 0
src/CallCenter.Api/appsettings.json

@@ -47,6 +47,10 @@
     "CallCenter": "server=110.188.24.182;Database=callcenter;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
     "CallCenter": "server=110.188.24.182;Database=callcenter;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
     "Redis": "110.188.24.182"
     "Redis": "110.188.24.182"
   },
   },
+  "Cache": {
+    "Host": "110.188.24.182",
+    "Database": 2
+  },
   "Swagger": true,
   "Swagger": true,
   "Cors": {
   "Cors": {
     "Origins": [ "http://localhost:8888", "http://localhost:8695", "http://callcenter-admin.fengwo.com", "http://admin.call.fengwo.com" ]
     "Origins": [ "http://localhost:8888", "http://localhost:8695", "http://callcenter-admin.fengwo.com", "http://admin.call.fengwo.com" ]

+ 3 - 0
src/CallCenter.Caching/StartupExtensions.cs

@@ -23,6 +23,7 @@ namespace CallCenter.Caching
                 {
                 {
                     config.DBConfig.Endpoints.Add(new ServerEndPoint(options.ConnectionString, options.Port));
                     config.DBConfig.Endpoints.Add(new ServerEndPoint(options.ConnectionString, options.Port));
                     config.DBConfig.Database = options.Database;
                     config.DBConfig.Database = options.Database;
+                    config.DBConfig.Password = options.Password;
                     config.SerializerName = "xjson";
                     config.SerializerName = "xjson";
                 }, "r1");
                 }, "r1");
 
 
@@ -60,6 +61,8 @@ namespace CallCenter.Caching
 
 
         public int Port { get; set; } = 6379;
         public int Port { get; set; } = 6379;
 
 
+        public string Password { get; set; }
+
         public int Database { get; set; }
         public int Database { get; set; }
 
 
         public string Prefix { get; set; }
         public string Prefix { get; set; }