hypercount

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package hypercount 面向对象的计数估计类型 HyperCount 用于粗略统计大量数据去重后的个数,一般用在日活计算

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HyperCount

type HyperCount struct {
	*clientkey.ClientKey
}

HyperCount 估计计数对象

func New

New 创建一个新的计数对象 @params k *key.Key redis客户端的键对象

func (*HyperCount) Add

func (c *HyperCount) Add(ctx context.Context, item interface{}) error

Add 添加数据 @params ctx context.Context 上下文信息,用于控制请求的结束 @params item interface{} 添加的数据

func (*HyperCount) AddM

func (c *HyperCount) AddM(ctx context.Context, items ...interface{}) error

AddM 添加数据 @params ctx context.Context 上下文信息,用于控制请求的结束 @params items ...interface{} 添加的数据

func (*HyperCount) Len

func (c *HyperCount) Len(ctx context.Context) (int64, error)

Len 检查HyperLogLog中不重复元素的个数 @params ctx context.Context 上下文信息,用于控制请求的结束

func (*HyperCount) Reset

func (c *HyperCount) Reset(ctx context.Context) error

Reset 重置当前hypercount @params ctx context.Context 上下文信息,用于控制请求的结束

func (*HyperCount) Union

func (c *HyperCount) Union(ctx context.Context, targetbmkey *clientkey.ClientKey, otherbm *HyperCount) (*HyperCount, error)

Union 对应set的求并集操作 @params ctx context.Context 上下文信息,用于控制请求的结束 @params targetbmkey *clientkey.ClientKey 目标key对象 @params otherbms ...*Bitmap 与之做并操作的其他bitmap对象

Jump to

Keyboard shortcuts

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