redis

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvertedIndexDbPathDayKey    = "index_platform:inverted_index:day"       // 天纬度
	InvertedIndexDbPathMonthKey  = "index_platform:inverted_index:month:%s"  // 月纬度
	InvertedIndexDbPathSeasonKey = "index_platform:inverted_index:season:%s" // 季纬度

	TireTreeDbPathDayKey    = "index_platform:tire_tree:day"       // 天纬度
	TireTreeDbPathMonthKey  = "index_platform:tire_tree:month:%s"  // 月纬度
	TireTreeDbPathSeasonKey = "index_platform:tire_tree:season:%s" // 季纬度

	// QueryTokenDocIds 搜索过的token的doc ids query:term --> docs ids
	QueryTokenDocIds = "query_doc_id:%s"
	// UserQueryToken 用户搜索过的token query:user_id --> term
	UserQueryToken = "query_token:%d"
)
View Source
const (
	QueryTokenDocIdsDefaultTimeout = 10 * time.Minute
)

Variables

InvertedIndexDbPathKeys 存放倒排索引的路径

View Source
var RedisClient *redis.Client

RedisClient Redis缓存客户端单例

View Source
var RedisContext = context.Background()

TireTreeDbPathKey 存放tire tree树的路径

Functions

func BatchDeleteInvertedIndexPath added in v0.1.2

func BatchDeleteInvertedIndexPath(ctx context.Context, keys []string) (err error)

BatchDeleteInvertedIndexPath 批量删除 inverted index path

func DeleteInvertedIndexPath added in v0.1.2

func DeleteInvertedIndexPath(ctx context.Context, key string) (err error)

DeleteInvertedIndexPath 删除 inverted index path

func GetInvertedIndexDbPathMonthKey added in v0.1.2

func GetInvertedIndexDbPathMonthKey(month string) string

func GetInvertedIndexDbPathSeasonKey added in v0.1.2

func GetInvertedIndexDbPathSeasonKey(season string) string

func GetInvertedIndexTokenDocIds

func GetInvertedIndexTokenDocIds(ctx context.Context, token string) (docIds *roaring.Bitmap, err error)

GetInvertedIndexTokenDocIds 获取缓存的结果

func GetInvertedPath added in v0.1.2

func GetInvertedPath(ctx context.Context, key string) (path string, err error)

GetInvertedPath 获取存储的path信息

func InitRedis

func InitRedis()

InitRedis 在中间件中初始化redis链接

func ListAllPrefixKey added in v0.1.2

func ListAllPrefixKey(ctx context.Context, prefixKey string) (paths []string, err error)

ListAllPrefixKey 通过前缀获取所有的value index_platform:inverted_index:month:*

func ListInvertedIndexByPrefixKey added in v0.1.2

func ListInvertedIndexByPrefixKey(ctx context.Context, prefixKey string) (paths []string, err error)

ListInvertedIndexByPrefixKey 通过前缀获取所有的value index_platform:inverted_index:month:*

func ListInvertedIndexToken

func ListInvertedIndexToken(ctx context.Context, userId int64) (tokens []string, err error)

ListInvertedIndexToken 获取用户搜索的历史记录

func ListInvertedPath

func ListInvertedPath(ctx context.Context, keys []string) (paths []string, err error)

ListInvertedPath 把存放在redis的信息放到path中 包括day,week,season的

func PushInvertedIndexToken

func PushInvertedIndexToken(ctx context.Context, userId int64, token string) (err error)

PushInvertedIndexToken 存储用户搜索的历史记录 docs ids // TODO:后面嵌入LRU

func PushInvertedMonthPath added in v0.1.2

func PushInvertedMonthPath(ctx context.Context, key string, paths []string) (err error)

PushInvertedMonthPath 把存放db的path信息放到redis中 month 纬度

func PushInvertedPath

func PushInvertedPath(ctx context.Context, key string, paths []string) (err error)

PushInvertedPath 把存放db的path信息放到redis中

func SetInvertedIndexTokenDocIds

func SetInvertedIndexTokenDocIds(ctx context.Context, token string, docIds *roaring.Bitmap) (err error)

SetInvertedIndexTokenDocIds 缓存搜索过的结果 // TODO:后面嵌入LRU

func SetInvertedPath added in v0.1.2

func SetInvertedPath(ctx context.Context, key string, path string) (err error)

SetInvertedPath 把存放db的path信息放到redis中

Types

This section is empty.

Jump to

Keyboard shortcuts

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