Nosql 之 Redis(可做缓存 )

下载 可以下载解压安装的 地址:https://github.com/dmajkic/redis/downloads

修改 redis.conf

取消注释 requirepass foobared
运行 redis-server
运行 redis-cli
授权 auth foobared

下载 nuget包 ServiceStack.Redis

c#

static void Main(string[] args)
        {
            string host = "127.0.0.1";
            string elementKey = "testKey";
            int port = 6379;

            RedisClient rc = new RedisClient(host, port, "foobared");

            rc.Set(elementKey, "hello redis");

            string res = rc.Get<string>(elementKey);
            Console.WriteLine(res);

            Console.ReadLine();
        }

 

posted @ 2016-05-12 01:10  nele  阅读(358)  评论(0编辑  收藏  举报