redis学习

官网: http://redis.io

中文翻译: http://redis.cn/

windows预编好的版本下载:

https://github.com/dmajkic/redis/downloads

 

客户端API:

C#

ServiceStack.Redis  Homepage demisbellot This is a fork and improvement of the original C# client written by Miguel De Icaza.
Booksleeve   Homepage marcgravell

This client was developed by Stack Exchange for very high performance needs.

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

文档: https://github.com/ServiceStack/ServiceStack.Redis/wiki

 

http://code.google.com/p/booksleeve/ 

 

 

附: Fastest JSON Serializer for .NET released

http://www.servicestack.net/mythz_blog/?p=344

 

ServiceStack.Redis 客户端IP是比较复杂强大的,可惜目前只支持 .net framework 2.0, 3.5

示例:

 IRedisClient client = new RedisClient("127.0.0.1", 6379);
            //存储用户名和密码  
            client.Set<string>("email", "gg@qq.com");
            client.Set<int>("age", 123456);
            string email = client.Get<string>("email");
            int age = client.Get<int>("age");
            client.Set<decimal>("weight", 12.10M);
            decimal weight = client.Get<decimal>("weight");

            Console.WriteLine("email:" + email);
            Console.WriteLine("age:" + age);
            Console.WriteLine("weight:" + weight);

  

Booksleeve 相比轻量级得多,支持.net framework 4.0.

示例:

 using (var conn = new RedisConnection("localhost"))
            {
                conn.Open();
                conn.Strings.Set(0, "hello", "中国!@#$!@#$");
                
                var value = conn.Strings.GetString(0, "hello");
                string sRet = conn.Wait(value);
                Console.WriteLine(sRet);
                
                //conn.Lists
                //conn.Hashes
                //conn.Sets
                //conn.SortedSets
             
            }

  

 

 

posted @ 2013-04-21 21:21  庚武  Views(676)  Comments(1Edit  收藏  举报