添加日志

This commit is contained in:
2026-02-04 18:06:18 +08:00
parent 3de5990573
commit b9ef94a671
28 changed files with 134 additions and 54 deletions

40
ConsoleApp2/GoodRedis.cs Normal file
View File

@@ -0,0 +1,40 @@
using CSRedis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
public class GoodRedis
{
public static CSRedisClient? redis6;
private const string ip = "127.0.0.1";
private const string port = "6379";
static GoodRedis()
{
var redisHostStr = string.Format("{0}:{1}", ip, port);
if (!string.IsNullOrEmpty(redisHostStr))
{
redis6 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=6");
//string channel = "__keyevent@6__:expired";
string channel = "__keyevent@6__:expired";
var QQQ = new ValueTuple<string, Action<CSRedisClient.SubscribeMessageEventArgs>>(channel, (msg) =>
{
//body 是键
string data = msg.Body;
try
{
Console.WriteLine(data);
}
catch (Exception ex)
{
}
});
redis6.Subscribe(QQQ);
}
}
}
}

View File

@@ -5,6 +5,7 @@ using BLWData.Entity;
using CommonEntity;
using CommonTools;
using MessagePack;
using Newtonsoft.Json;
namespace ConsoleApp2
{
@@ -13,6 +14,10 @@ namespace ConsoleApp2
static void Main(string[] args)
{
GoodRedis.redis6.Set("aaa", "bbb", 10);
Console.ReadLine();
string YYY111111 = File.ReadAllText("2.txt");
var o = JsonConvert.DeserializeObject<CommonEntity.OnOffLineData>(YYY111111);
string afds = "hello";
string dda = afds;
dda = "world";
@@ -52,7 +57,7 @@ namespace ConsoleApp2
string HOSTNUMBER = "099008" + MAC1 + MAC2;
string nnn = File.ReadAllText("1.txt");
UDPPackage? usa = JsonSerializer.Deserialize<UDPPackage>(nnn);
UDPPackage? usa = System.Text.Json.JsonSerializer.Deserialize<UDPPackage>(nnn);
AAA a = new AAA();
MyClass mm = new MyClass();
mm.Age = 30;