|
@@ -95,6 +95,7 @@ namespace WCS.Service
|
|
|
private static Dictionary<string, Playerback> Clients = new Dictionary<string, Playerback>();
|
|
|
|
|
|
private static RedisClient Redis;
|
|
|
+ private static RedisClient YGRedis;
|
|
|
|
|
|
static ProtocolProxy()
|
|
|
{
|
|
@@ -110,6 +111,18 @@ namespace WCS.Service
|
|
|
var obj = MessagePackSerializer.Deserialize(type, bytes);
|
|
|
return obj;
|
|
|
};
|
|
|
+
|
|
|
+ YGRedis = new RedisClient("106.15.78.3,password=Password@123$%^,database=1");
|
|
|
+ YGRedis.Serialize = obj =>
|
|
|
+ {
|
|
|
+ var bytes = MessagePackSerializer.Serialize(obj);
|
|
|
+ return bytes;
|
|
|
+ };
|
|
|
+ YGRedis.DeserializeRaw = (bytes, type) =>
|
|
|
+ {
|
|
|
+ var obj = MessagePackSerializer.Deserialize(type, bytes);
|
|
|
+ return obj;
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
//static ConcurrentDictionary<string, DeviceData> Datas = new ConcurrentDictionary<string, DeviceData>();
|
|
@@ -196,20 +209,26 @@ namespace WCS.Service
|
|
|
var sw = new Stopwatch();
|
|
|
sw.Start();
|
|
|
Redis.Set(nameof(DeviceDataPack), pack);
|
|
|
+ YGRedis.Set(nameof(DeviceDataPack), pack);
|
|
|
sw.Stop();
|
|
|
Console.ForegroundColor = ConsoleColor.Blue;
|
|
|
Console.WriteLine($"Redis耗时{sw.ElapsedMilliseconds}");
|
|
|
Console.ResetColor();
|
|
|
|
|
|
Redis.RPush("Packs", pack);
|
|
|
-
|
|
|
var len = Redis.LLen("Packs");
|
|
|
-
|
|
|
if (len > 150000)
|
|
|
{
|
|
|
Redis.LTrim("Packs", 20000, len);
|
|
|
}
|
|
|
|
|
|
+ YGRedis.RPush("Packs", pack);
|
|
|
+ var YGlen = YGRedis.LLen("Packs");
|
|
|
+ if (YGlen > 150000)
|
|
|
+ {
|
|
|
+ YGRedis.LTrim("Packs", 20000, YGlen);
|
|
|
+ }
|
|
|
+
|
|
|
foreach (var data in AllDatas)
|
|
|
{
|
|
|
data.Value.Info = "";
|