RedisUtil.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RedisDemo
{
public class RedisUtil
{
public RedisClient client = null;
/// <summary>
/// 开启redis服务
/// </summary>
/// <returns></returns>
public bool Start()
{
if (Process.GetProcessesByName("redis-server.exe").Length > 0)
{
return false;
}
Process process = new Process();
process.StartInfo.WorkingDirectory = @"F:\Redis";
process.StartInfo.FileName = @"F:\Redis\startup.bat";
process.StartInfo.CreateNoWindow = false;
process.StartInfo.UseShellExecute = false;
process.Start();
return true;
}
/// <summary>
/// 关闭redis服务
/// </summary>
/// <returns></returns>
public bool Close()
{
bool flag = false;
foreach (Process process in Process.GetProcesses())
{
if (process.ProcessName.Contains("redis-server"))
{
process.Kill();
flag = true;
}
}
return flag;
}
/// <summary>
/// 连接redis服务
/// </summary>
/// <returns></returns>
public void Connect()
{
if (client == null)
{
client = new RedisClient("127.0.0.1", 6379);
后面还有 227 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
