ubcache

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2022 License: AGPL-3.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeSeq

type TimeSeq struct {
	Ts    []int64
	Items []int64
}

TimeSeq is a sequence in Ts desc order

func (*TimeSeq) Filter

func (seq *TimeSeq) Filter(maxTs int64, maxLen int64) *TimeSeq

Filter sequence by maxTs and maxLen

type UserBehavior

type UserBehavior map[int64]*TimeSeq //map[userId]*TimeSeq

type UserBehaviorCache

type UserBehaviorCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewUserBehaviorCache

func NewUserBehaviorCache() *UserBehaviorCache

func (*UserBehaviorCache) BatchSet

func (c *UserBehaviorCache) BatchSet(ub UserBehavior)

BatchSet batch set user behavior sequence

func (*UserBehaviorCache) Clear

func (c *UserBehaviorCache) Clear()

Clear all user behavior sequence

func (*UserBehaviorCache) Delete

func (c *UserBehaviorCache) Delete(userId int64)

Delete user behavior sequence by userId

func (*UserBehaviorCache) Get

func (c *UserBehaviorCache) Get(userId int64, maxTs int64, count int64) (seq *TimeSeq, err error)

Get user behavior sequence by userId and filtered by maxTs and count

func (*UserBehaviorCache) Set

func (c *UserBehaviorCache) Set(userId int64, seq *TimeSeq)

Set user behavior sequence by userId

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL