redis 시스템 수정
This commit is contained in:
parent
69fd6b249c
commit
72c491b216
|
|
@ -1,5 +1,6 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
|
using static Quartz.Logging.OperationName;
|
||||||
|
|
||||||
namespace Server.System
|
namespace Server.System
|
||||||
{
|
{
|
||||||
|
|
@ -14,7 +15,7 @@ namespace Server.System
|
||||||
Dictionary<string, List<string>> listType;
|
Dictionary<string, List<string>> listType;
|
||||||
Dictionary<string, List<Rank>> zType;
|
Dictionary<string, List<Rank>> zType;
|
||||||
Dictionary<string, Dictionary<string, string>> hashType;
|
Dictionary<string, Dictionary<string, string>> hashType;
|
||||||
public Redis(string host = "127.0.0.1", int port = 6379)
|
public Redis(string host = "127.0.0.1", int port = 6379, int db = 0)
|
||||||
{
|
{
|
||||||
if (host == "localhost")
|
if (host == "localhost")
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +28,7 @@ namespace Server.System
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
redis = ConnectionMultiplexer.Connect($"{host}:{port}");
|
redis = ConnectionMultiplexer.Connect($"{host}:{port}");
|
||||||
db = redis.GetDatabase();
|
this.db = redis.GetDatabase(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,25 +39,25 @@ namespace Server.System
|
||||||
Console.WriteLine("--------------------");
|
Console.WriteLine("--------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetString(object value, params string[] keys)
|
public void SetString(string value, params string[] keys)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
{
|
{
|
||||||
if (stringType.ContainsKey(KeySet(keys)))
|
if (stringType.ContainsKey(KeySet(keys)))
|
||||||
stringType[KeySet(keys)] = JsonConvert.SerializeObject(value);
|
stringType[KeySet(keys)] = value;
|
||||||
else
|
else
|
||||||
stringType.Add(KeySet(keys), JsonConvert.SerializeObject(value));
|
stringType.Add(KeySet(keys), value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
db.StringSet(KeySet(keys), JsonConvert.SerializeObject(value));
|
db.StringSet(KeySet(keys), JsonConvert.SerializeObject(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetString<T>(params string[] keys)
|
public string GetString(params string[] keys)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
return JsonConvert.DeserializeObject<T>(stringType[KeySet(keys)]);
|
return stringType[KeySet(keys)];
|
||||||
else
|
else
|
||||||
return JsonConvert.DeserializeObject<T>(db.StringGet(key: KeySet(keys)));
|
return db.StringGet(key: KeySet(keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetList<T>(T value, params string[] keys)
|
public void SetList<T>(T value, params string[] keys)
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,13 @@ namespace Server.System
|
||||||
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
||||||
|
public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1);
|
||||||
#elif LIVE
|
#elif LIVE
|
||||||
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel_live.git";
|
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel_live.git";
|
||||||
|
public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1);
|
||||||
#endif
|
#endif
|
||||||
public static readonly Redis redis = new Redis("172.16.18.244", 48600);
|
|
||||||
|
|
||||||
public static readonly string URL = "https://0.0.0.0:4860";
|
public static readonly string URL = "https://0.0.0.0:4860";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue