cache.go 900 B

12345678910111213141516171819202122232425262728293031
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/service/main/thumbup/model"
  6. )
  7. //go:generate $GOPATH/src/go-common/app/tool/cache/gen
  8. type _cache interface {
  9. // 用户点赞列表
  10. // cache: -singleflight=true -ignores=||start,end
  11. userLikeList(c context.Context, mid int64, businessID int64, state int8, start, end int) (res []*model.ItemLikeRecord, err error)
  12. }
  13. func (d *Dao) cacheSFuserLikeList(mid, businessID int64, state int8, start, end int) string {
  14. return fmt.Sprintf("sf_u%v_%v_%v", mid, businessID, state)
  15. }
  16. // UserLikeList 用户点赞列表
  17. func (d *Dao) UserLikeList(c context.Context, mid int64, businessID int64, state int8, start, end int) (res []*model.ItemLikeRecord, err error) {
  18. var ls []*model.ItemLikeRecord
  19. ls, err = d.userLikeList(c, mid, businessID, state, start, end)
  20. for _, x := range ls {
  21. if x.MessageID != -1 {
  22. res = append(res, x)
  23. }
  24. }
  25. return
  26. }