C# Redis简单存储string
1首先启动redis
打开资源管理器,找到服务
2在项目中打开NuGet包
3找到安装
4项目中添加引用
5 编写代码
private void Button1_Click(object sender, EventArgs e) { RedisClient client = new RedisClient("127.0.0.1", 6379); AddString(client); }
private static void AddString(RedisClient client) { client.Set("qhh", "qihaohao");//写入 //client.Add("qhh", "qihaohao"); MessageBox.Show(client.Get<string>("qhh"));//读取 }
完成