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