Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoteCache ¶
type NoteCache struct {
// contains filtered or unexported fields
}
Note cache stat representation states:
sorted set: {{list.0, score0}, {list.1, score1}, {list.2, score2}}
list:
list.0: [{"nid": "xxx", "inc": 1}, {"nid": "xxx", "inc": 1}] list.1: [{"nid": "xxx", "inc": -1}, {"nid": "xxx", "inc": -1}] list.2: [{"nid": "xxx", "inc": 1}, {"nid": "xxx", "inc": -1}]
func NewNoteCache ¶
func (*NoteCache) Add ¶
func (b *NoteCache) Add(ctx context.Context, statType NoteInteractStatType, stat NoteStatRepr) error
数据先行写入redis
func (*NoteCache) ConsumeCommentCount ¶
func (*NoteCache) ConsumeLikeCount ¶
type NoteInteractStatType ¶
type NoteInteractStatType string
const ( NoteLikeCountStat NoteInteractStatType = "note_like" NoteCommentCountStat NoteInteractStatType = "note_comment" )
type NoteStatRepr ¶
type NoteStatRepr struct { Type NoteInteractStatType `json:"-"` NoteId string `json:"nid"` // note_id Inc int64 `json:"inc"` // increment }
Click to show internal directories.
Click to hide internal directories.