Redis in .NET

4 篇文章 0 订阅

Redis

  1. https://github.com/MSOpenTech/redis
  2. 点击链接:Download ZIP,并解压缩至本地文件夹
  3. 进入文件夹:.\redis-3.0\msvs,使用Visual Studio打开文件RedisServer.sln


  1. Build设置为X64Release,编译整个SolutionBuild完成之后,将以下文件拷贝到指定文件夹(比如: d:\RedisServer\)。

redis-benchmark.exe

redis-check-aof.exe

redis-check-dump.exe

redis-cli.exe

redis-server.exe

 

同时,将根目录下的文件.\redis-3.0\redis.conf同样拷贝到此指定文件夹,完成之后如下图所示:


 

ServiceStack.Redis

  1. Windows下使用Redis,我们需要第三方驱动,此处我们使用的是ServiceStack.Redis.

访问以下地址:https://github.com/ServiceStack/ServiceStack.Redis Download ZIP

  1. 解压缩并打开Solution: .\ServiceStack.Redis-master\src\ServiceStack.Redis.sln;Build配置为X64, Release

编译之后文件生成在文件夹:.\ServiceStack.Redis-master\src\ServiceStack.Redis\bin\Release下:


  1. 新建一个控制台工程,将以上*.dll文件引入工程,添加以下代码:

using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace RedisDemo
{
    class Program
    {
        static RedisClientredisclient = new RedisClient("10.86.20.82", 6379);
 
        static void Main(string[] args)
        {
            C1 c = new C1(){Name = "abc", Age = 22};
           redisclient.Set<C1>("c1", c);
           redisclient.Save();
 
            C1 c1 =redisclient.Get<C1>("c1");
           Console.WriteLine(c1.Name + "-" + c1.Age);
        }
 
        public class C1
        {
            public string Name{ get; set; }
            public int Age {get; set; }
        }
    }
}

  1. RedisClient API

https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisClient

 

Redis UI Tools

RedisReact:

https://github.com/ServiceStackApps/RedisReact

RedisDesktop:

http://redisdesktop.com/download

https://github.com/uglide/RedisDesktopManager/wiki/Quick-Start

https://github.com/ServiceStack/ServiceStack.Redis/wiki/Useful-Redis-Links

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值