Comments (8)
object 支持 string 和 byte[]
from csredis.
存 byte[] 的话不需要序列化
from csredis.
//
// 摘要:
// 只有在字段 field 不存在时,设置哈希表字段的值。
//
// 参数:
// key:
// 不含prefix前辍
//
// field:
// 字段
//
// value:
// 值(string 或 byte[])
public static bool HashSetNx(string key, string field, object value);
注释有标明的。
from csredis.
你好再请教一个问题,我现在Redis只有主从模式,没有集群模式
有这个(主从)的配置示例吗?
没有看到相关示例,非常感谢!!
from csredis.
主从模式要使用 CSRedis.RedisSentinelClient,目前没有封装到 CSRedisClient 和 RedisHelper 中。
from csredis.
using (var sentinel = new RedisSentinelManager("host1:123", "host2:456"))
{
sentinel.Add(Host); // add host using default port
sentinel.Add(Host, 36379); // add host using specific port
sentinel.Connected += (s, e) => sentinel.Call(x => x.Auth(Password)); // this will be called each time a master connects
sentinel.Connect("mymaster"); // open connection
var test2 = sentinel.Call(x => x.Time()); // use the Call() lambda to access the current master connection
}
from csredis.
谢谢了!!!
from csredis.
CSRedisClient 和 RedisHelper 提供的集群模式功能,也可以现实高可用。
static redis1 = new CSRedisClient("192.168.1.9:6379,password=,defaultDatabase=1,poolsize=1");
static redis2 = new CSRedisClient("192.168.1.9:6379,password=,defaultDatabase=2,poolsize=1");
var client = new CSRedisClient(
key => {
//在这里判断服务有效性
try { redis1.Ping(); return "192.168.1.9:6379/1"; } catch { }
try { redis2.Ping(); return "192.168.1.9:6379/2"; } catch { }
return "192.168.1.9:6379/1";
},
"192.168.1.9:6379,password=,defaultDatabase=1",
"192.168.1.9:6379,password=,defaultDatabase=2");
这个做法有点生硬,之后会优化。
from csredis.
Related Issues (20)
- 3.8.671 vs 3.8.668 HOT 1
- TONG RDS(国产信创) 哨兵有问题 HOT 9
- 请问在哪里查看版本更新日志 HOT 2
- Thread CurrentCulture csredis hash exception with docker container HOT 15
- Linux 下面 Connection timed out.问题有办法解决吗? HOT 1
- 读取redis抛InvalidCastException HOT 1
- cacheshell哈希表不支持设置-1永久有效 HOT 3
- 请问可以监听redis键过期事件吗 HOT 1
- 请问一下有没有方法取消管道操作 HOT 4
- 这块每次 new byte对GC不太友好,还有读取的时候,建议使用 ArrayPool了
- 链接池中数量
- SlowLogGetAsync HOT 4
- csrediscore is missing NuGet package README file
- 关于前缀的问题 HOT 1
- 哨兵 Master 重新选举后出现 Connection was not opened HOT 3
- ReadLine()判断不严谨,导致内存暴增问题 HOT 4
- feat 增加获取锁间隔
- Status unavailable, waiting for recovery. Connect to server timeout HOT 4
- 内网环境下Status unavailable, waiting for recovery. Connect to server timeout HOT 2
- 内网环境下Status unavailable, waiting for recovery. Connect to server timeout HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csredis.