123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- package dao
- import (
- "context"
- "strconv"
- "go-common/app/interface/openplatform/article/model"
- )
- func (d *Dao) cacheSFList(id int64) string {
- return strconv.FormatInt(id, 10)
- }
- func (d *Dao) cacheSFListArts(id int64) string {
- return strconv.FormatInt(id, 10)
- }
- func (d *Dao) cacheSFUpLists(id int64) string {
- return strconv.FormatInt(id, 10)
- }
- type _cache interface {
-
- List(c context.Context, id int64) (*model.List, error)
-
- Lists(c context.Context, keys []int64) (map[int64]*model.List, error)
-
- ListArts(c context.Context, id int64) ([]*model.ListArtMeta, error)
-
- ListsArts(c context.Context, ids []int64) (map[int64][]*model.ListArtMeta, error)
-
- ArtsListID(c context.Context, keys []int64) (map[int64]int64, error)
-
- UpLists(c context.Context, mid int64) ([]int64, error)
-
- Author(c context.Context, mid int64) (*model.AuthorLimit, error)
- }
- type _mc interface {
-
-
- CacheListArts(c context.Context, id int64) (res []*model.ListArtMeta, err error)
-
-
- AddCacheListArts(c context.Context, id int64, arts []*model.ListArtMeta) (err error)
-
-
- ArticleListCache(c context.Context, id int64) (res int64, err error)
-
-
- SetArticlesListCache(c context.Context, arts map[int64]int64) (err error)
-
- CacheList(c context.Context, id int64) (res *model.List, err error)
-
- AddCacheList(c context.Context, id int64, list *model.List) (err error)
-
- CacheLists(c context.Context, ids []int64) (res map[int64]*model.List, err error)
-
- AddCacheLists(c context.Context, lists map[int64]*model.List) (err error)
-
- CacheListsArts(c context.Context, ids []int64) (res map[int64][]*model.ListArtMeta, err error)
-
- AddCacheListsArts(c context.Context, arts map[int64][]*model.ListArtMeta) (err error)
-
- CacheArtsListID(c context.Context, ids []int64) (res map[int64]int64, err error)
-
- AddCacheArtsListID(c context.Context, arts map[int64]int64) (err error)
-
- AddCacheUpLists(c context.Context, mid int64, lists []int64) (err error)
-
- CacheUpLists(c context.Context, id int64) (res []int64, err error)
-
- AddCacheListReadCount(c context.Context, id int64, read int64) (err error)
-
- CacheListReadCount(c context.Context, id int64) (res int64, err error)
-
- CacheListsReadCount(c context.Context, ids []int64) (res map[int64]int64, err error)
-
- AddCacheHotspots(c context.Context, hots []*model.Hotspot) (err error)
-
- DelCacheHotspots(c context.Context) (err error)
-
- cacheHotspots(c context.Context) (res []*model.Hotspot, err error)
-
- CacheHotspot(c context.Context, id int64) (res *model.Hotspot, err error)
-
- AddCacheHotspot(c context.Context, id int64, val *model.Hotspot) (err error)
-
-
- AddCacheAuthor(c context.Context, mid int64, author *model.AuthorLimit) (err error)
-
- CacheAuthor(c context.Context, mid int64) (res *model.AuthorLimit, err error)
-
- DelCacheAuthor(c context.Context, mid int64) (err error)
-
- CacheListArtsId(c context.Context, buvid string) (*model.ArticleViewList, error)
-
- AddCacheListArtsId(c context.Context, buvid string, val *model.ArticleViewList) error
-
- DelCacheListArtsId(c context.Context, buvid string) error
-
- CacheAnniversary(c context.Context, mid int64) (*model.AnniversaryInfo, error)
-
- CacheAidsByTag(c context.Context, tag int64) (*model.TagArts, error)
-
- AddCacheAidsByTag(c context.Context, tag int64, val *model.TagArts) error
-
- CacheUpStatDaily(c context.Context, mid int64) (*model.UpStat, error)
-
- AddCacheUpStatDaily(c context.Context, mid int64, val *model.UpStat) error
- }
- func (d *Dao) RebuildUpListsCache(c context.Context, mid int64) (err error) {
- lists, err := d.RawUpLists(c, mid)
- if err != nil {
- return
- }
- return d.AddCacheUpLists(c, mid, lists)
- }
- func (d *Dao) RebuildListReadCountCache(c context.Context, id int64) (err error) {
- res, err := d.RawListReadCount(c, id)
- if err != nil {
- return
- }
- return d.AddCacheListReadCount(c, id, res)
- }
|