Documentation
¶
Overview ¶
实现方法: func AddRelation(userId int64, toUserId int64) 增加关系 func DeleteRelation(userId int64, toUserId int64) 删除关系 func PutFollowList(userId int64, FollowList []int64) 将数据库数据写入到redis中 func PutFollowerList(userId int64, FollowerList []int64) 将数据库文件写入到redis中
Index ¶
- Constants
- Variables
- func AddRelation(ctx context.Context, userId int64, toUserId int64) error
- func Close()
- func DeleteRelation(ctx context.Context, userId int64, toUserId int64) error
- func GetFollowList(ctx context.Context, userId int64) ([]int64, error)
- func GetFollowerList(ctx context.Context, userId int64) ([]int64, error)
- func GetFriendList(ctx context.Context, userId int64) ([]int64, error)
- func GetIsFollow(ctx context.Context, userId int64, toUserId int64) (bool, error)
- func GetRedisKey(servicename, key string) string
- func Init() (err error)
- func IsFollowKeyExist(ctx context.Context, userId int64) (bool, error)
- func IsFollowerKeyExist(ctx context.Context, userId int64) (bool, error)
- func PutFollowList(ctx context.Context, userId int64, FollowIdList []int64) error
- func PutFollowerList(ctx context.Context, userId int64, FollowerIdList []int64) error
Constants ¶
View Source
const ( Prefix = "douyin:" // 项目key前缀 KeyUserInfo = "userinfo:" //保存用户信息 KeyUserId = "userId:" //保存用户信息 )
redis key 注意使用命名空间的方式,方便查询和拆分
Variables ¶
View Source
var (
Nil = redis.Nil
)
Functions ¶
func AddRelation ¶
在Redis中添加一个关系
func DeleteRelation ¶
在Redis中删除一段关系
func GetIsFollow ¶
func IsFollowKeyExist ¶
检查给定的 userId 的关注列表是否存在
func IsFollowerKeyExist ¶
检查给定的 userId 的粉丝列表是否存在
func PutFollowList ¶
把FollowList 关注用户列表数据写回redis
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.