🎯

布隆过滤器

 
本质上布隆过滤器是一种数据结构,比较巧妙的概率型数据结构(probabilistic data structure),特点是高效地插入和查询,可以用来告诉你 “某样东西一定不存在或者可能存在”
 
import ( "github.com/zlsgo/bloom" ) filter := bloom.New(1024, 2, true) // 添加 filter.Add([]byte("Hello")).AddString("World") // 验证是否存在 filter.Check([]byte("Hello"))