项目作者: mushroomsir

项目描述 :
Redis和Redis Sentinel的Net客户端
高级语言: C#
项目地址: git://github.com/mushroomsir/HRedis.git
创建时间: 2015-01-09T14:57:16Z
项目社区:https://github.com/mushroomsir/HRedis

开源协议:

下载


配置说明:

  1. new RedisClient(new RedisConfiguration()
  2. {
  3. Host = "127.0.0.1", //服务器
  4. Port = 6379, //端口
  5. PassWord = "123456", //redis密码,没有则不填
  6. ReceiveTimeout = 0, //接收超时时间
  7. SendTimeout = 0 //发送超时时间
  8. });

基本连接

  1. using (RedisClient client = new RedisClient("127.0.0.1", 6381))
  2. {
  3. client.Set("key", "value");
  4. client.Get("key");
  5. }

使用连接池

  1. PoolRedisClient prc = new PoolRedisClient(new PoolConfiguration());
  2. prc.Single.Set("key", "value");
  3. prc.Single.Get("key");

or

  1. prc.Multi(client =>
  2. {
  3. client.Set("key", "value");
  4. return client.Get("key");
  5. });