WinTest/Program.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using ShiQuan.Logger;
using ShiQuan.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WinTest
{
class Program
{
static void Main(string[] args)
{
try
{
//Console.WriteLine("输入Redis IP:");
//string ip = Console.ReadLine();
//Console.WriteLine("port:");
//int port = Convert.ToInt32(Console.ReadLine());
using (RedisClient client = new RedisClient("127.0.0.1", 6379))//127.0.0.1:6381
{
Console.WriteLine("开始连接:" + client.IP + " " + client.Port);
bool connect = client.Connect();
if (connect == false)
{
Console.WriteLine("连接失败!");
return;
}
client.Set<TestItem>("classId", new TestItem() { ClassId="classId",ClassName="className"});
var testItem = client.Get<TestItem>("classId");
Console.WriteLine("ClassId=" + testItem.ClassId + " ClassName=" + testItem.ClassName);
string result = "";
var content = "";
do
{
Console.Write(client.IP + ":" + client.Port + ">");
content = Console.ReadLine().ToLower().Trim();
if (string.IsNullOrEmpty(content) || content == "")
continue;
string[] commands = content.Split(' ');
switch (commands[0])
{
case "set":
{
string key = commands[1];
string value = commands[2];
ThreadLogHelper.Info("set","key=" + key + " value=" + value);
result = client.Set(key, value);
Console.WriteLine(result);
break;
}
case "get":
{
string key = commands[1];
ThreadLogHelper.Info("get", "key=" + key);
result = client.Get(key);
Console.WriteLine(result);
break;
后面还有 41 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
