08 2016 档案

摘要:订阅: 发布: 阅读全文
posted @ 2016-08-25 17:25 以沫浅夏 阅读(449) 评论(0) 推荐(0)
摘要:class Program { //版本2:使用Redis的客户端管理器(对象池) public static IRedisClientsManager redisClientManager = new PooledRedisClientManager(new string[] { //如果是Redis集群则配置多... 阅读全文
posted @ 2016-08-25 16:35 以沫浅夏 阅读(2966) 评论(0) 推荐(0)
摘要:测试:private static void TestIdWorker() { HashSet set = new HashSet(); IdWorker idWorker1 = new IdWorker(0, 0); IdWorker idWorker2 = new IdWorker(1, 0); ... 阅读全文
posted @ 2016-08-09 17:40 以沫浅夏 阅读(2988) 评论(0) 推荐(0)
摘要:/// /// 加权随机负载均衡算法 /// public static class WeightRandom { static Dictionary dic = new Dictionary { { "192.168.1.12", 1}, {"192.168.1.13"... 阅读全文
posted @ 2016-08-02 15:14 以沫浅夏 阅读(661) 评论(0) 推荐(0)
摘要:/// /// IP Hash负载均衡算法 /// public static class IpHash { static Dictionary dic = new Dictionary { { "192.168.1.12", 1}, {"192.168.1.13", 1 ... 阅读全文
posted @ 2016-08-02 15:14 以沫浅夏 阅读(5030) 评论(1) 推荐(0)
摘要:/// /// 加权轮询算法 /// public static class WeightRoundRobin { private static object obj = new object(); private static int pos = 0; static Dictionary dic = ... 阅读全文
posted @ 2016-08-02 15:13 以沫浅夏 阅读(625) 评论(0) 推荐(0)