Esempio n. 1
0
/**
 * 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
}
Esempio n. 2
0
/**
 * create sharded redis client
 */
func NewShardedRedis() *ShardedRedis {
	return &ShardedRedis{
		consisHash: utils.NewConsistentHash(true),
	}
}