biao199423 发表于 2015-7-20 10:37:16

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("email", "gg@qq.com");
client.Set("age", 123456);
string email = client.Get("email");
int age = client.Get("age");
client.Set("weight", 12.10M);
decimal weight = client.Get("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
}

  
  
  
页: [1]
查看完整版本: redis学习