コード例 #1
0
ファイル: server.go プロジェクト: yuwnloyblog/yundis
/**
 * initial the hash ring for slots
 */
func (self *YundisServer) initialSlotHashRing() {
	cHashRing := commonutils.NewConsistentHash(false)
	for i := 0; i < self.SlotCount; i++ {
		cHashRing.Add("slot"+strconv.Itoa(i), i, 1)
	}
	cHashRing.Prepare()
	self.slotHashRing = cHashRing
}
コード例 #2
0
ファイル: shardedredis.go プロジェクト: yuwnloyblog/gredis
/**
 * create sharded redis client
 */
func NewShardedRedis() *ShardedRedis {
	return &ShardedRedis{
		consisHash: utils.NewConsistentHash(true),
	}
}