Documentation
¶
Index ¶
- type Data
- type F64CountRank
- func (r *F64CountRank) DelByRank(start int64, stop int64) (err error)
- func (r *F64CountRank) DelScore(id int64) (err error)
- func (r *F64CountRank) Delete()
- func (r *F64CountRank) GetCount()
- func (r *F64CountRank) GetIdRankNotTs(id int64) (rankInfo *Data)
- func (r *F64CountRank) GetRankInfosNotTs(offset, count int) (list []*Data, err error)
- func (r *F64CountRank) IncrScore(id int64, score int64) (curScore float64, err error)
- func (r *F64CountRank) UpdateScore(id int64, score int64) (err error)
- type Mod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type F64CountRank ¶
type F64CountRank struct {
// contains filtered or unexported fields
}
func (*F64CountRank) DelByRank ¶
func (r *F64CountRank) DelByRank(start int64, stop int64) (err error)
DelScore 删除当前分数
@Description: @receiver r @param id @return err
func (*F64CountRank) DelScore ¶
func (r *F64CountRank) DelScore(id int64) (err error)
DelScore 删除当前分数
@Description: @receiver r @param id @return err
func (*F64CountRank) GetIdRankNotTs ¶
func (r *F64CountRank) GetIdRankNotTs(id int64) (rankInfo *Data)
获取指定id的当前排名
func (*F64CountRank) GetRankInfosNotTs ¶
func (r *F64CountRank) GetRankInfosNotTs(offset, count int) (list []*Data, err error)
GetRankInfosNotTs 获取0~count跳记录 不根据更新时间来
func (*F64CountRank) IncrScore ¶
func (r *F64CountRank) IncrScore(id int64, score int64) (curScore float64, err error)
IncrScore 对指定ID的分数进行增加,并返回增加后的当前分数。 该方法首先更新成员的更新时间戳,然后增加成员的分数。
参数:
id - 要操作的成员ID。 score - 要增加的分数。
返回值:
curScore - 增加分数后的当前分数。 err - 操作过程中可能发生的错误。
IncrScore 先改redis再改cache
@Description: @receiver r @param id @param score @return curScore @return err
func (*F64CountRank) UpdateScore ¶
func (r *F64CountRank) UpdateScore(id int64, score int64) (err error)
updateScore 更新给定ID的分数值。
参数:
id - 需要更新分数的实体ID。 score - 新的分数值。
返回值:
error - 更新过程中可能出现的错误。
该方法首先记录当前时间作为更新时间戳,然后将新的分数值添加到排名系统中。 使用Redis的ZAdd方法来确保操作的原子性和一致性。 UpdateScore 更新分数
@Description: @receiver r @param id @param score @return err
Click to show internal directories.
Click to hide internal directories.