Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGenericCuckoo ¶
默认参数的过滤容器, 全局使用一个容易造成碰撞, 因此拆分成四个 NewGenericCuckoo 极限容量约 400 万
Types ¶
type Config ¶
type Config struct { TTL int64 `json:"ttl" yaml:"ttl"` // 去重时间窗,秒为单位 CaseSensitive bool `json:"case_sensitive" yaml:"case_sensitive"` // 是否对 URL 中的大小写敏感 Hash bool `json:"hash" yaml:"hash"` // 是否将 URL hash 作为去重因素 Query bool `json:"query" yaml:"query"` // 是否将 query 作为去重因素, 若为 true, 那么 ?a=b 和 ?a=c 将被视为两个链接 Credential bool `json:"credential" yaml:"credential"` // 是否将认证信息作为去重因素,若为 true, 登录前后的同一页面可能会被扫描两次 Rewrite bool `json:"rewrite" yaml:"rewrite"` // 是否启用 rewrite 识别 }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type StringFilter ¶
func NewFilter ¶
func NewFilter() *StringFilter
NewFilter 创建一个默认的字符串布谷鸟过滤器,布谷鸟过滤器用于判断一个元素是否在一个集合中,它存在极低的假阳性(即说存在的元素实际上不存在),通常这个集合中的元素数量非常大才会使用布谷鸟过滤器。 Example: ``` f = str.NewFilter() f.Insert("hello") f.Exist("hello") // true ```
func NewFilterWithSize ¶ added in v1.2.7
func NewFilterWithSize(entries, total uint) *StringFilter
func NewStringFilter ¶
func NewStringFilter(config *Config, container *cuckoo.Filter) *StringFilter
func (*StringFilter) Exist ¶
func (s *StringFilter) Exist(str string) bool
func (*StringFilter) Insert ¶
func (s *StringFilter) Insert(str string) bool
返回值是 true,插入成功,false 容器满了, 无法继续添加
Click to show internal directories.
Click to hide internal directories.