Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedFilter ¶
Memory based BloomFilter. Only synchronize the bytes to the redis BITMAP when 'Write' method called. 基于内存的过滤器 只有在使用'Write'方法时才会将本地的字节数组同步到Redis服务器。
func (*CachedFilter) Clear ¶
func (f *CachedFilter) Clear() error
Delete the key in redis, and then reset all the bytes to zero. 首先删除REDIS中的对应键,再把所有字节置零。
func (*CachedFilter) Init ¶
func (f *CachedFilter) Init(context context.Context, cli *redis.Client, hashTableName string, key string) error
Initial the local bytes from the BITMAP on redis server. 同步Redis服务器上的BITMAP到本地的字节数组。
func (*CachedFilter) Write ¶
func (f *CachedFilter) Write() error
Write to the redis server only if the bytes have been changed. This may takes seconds if the byte amount is large. 只有在字节数组被改变过的情况下才会同步到服务器。如果字节数很多,会比较费时。
type InteractiveFilter ¶
type InteractiveFilter struct { Key string Cli *redis.Client Context context.Context ByteLen uint64 Hashes []global.HashFunc }
Interactive mode. Push/Exists/IsEmpty methods will interactive with the BITMAP on the redis server. 交互模式。使用Push/Exists/IsEmpty方法将直接操作在REDIS服务器上的BITMAP,本地不缓存数据。
func (*InteractiveFilter) Clear ¶
func (f *InteractiveFilter) Clear() error
Just delete the key. 直接删除键值
func (*InteractiveFilter) Close ¶
func (f *InteractiveFilter) Close() error
func (*InteractiveFilter) Exists ¶
func (f *InteractiveFilter) Exists(str []byte) bool
func (*InteractiveFilter) IsEmpty ¶
func (f *InteractiveFilter) IsEmpty() bool
func (*InteractiveFilter) Push ¶
func (f *InteractiveFilter) Push(str []byte)
update the bloom table immediately by redis pipeline. 使用Redis pipeline更新bloom表格。
func (*InteractiveFilter) Write ¶
func (f *InteractiveFilter) Write() error
should not use this method when use interactive mode. 交互模式不应使用Write方法