新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Merge pull request #20 from dengliming/f_bf_commands
filipe oliveira authored
Add Support for BF.LOADCHUNK BF.SCANDUMP
e00e2ac1

license CircleCI GitHub issues Codecov GoDoc

redisbloom-go

Go client for RedisBloom (https://github.com/RedisBloom/redisbloom), based on redigo.

Installing

$ go get github.com/RedisBloom/redisbloom-go

Running tests

A simple test suite is provided, and can be run with:

$ RedisBloom_TEST_PASSWORD="" go test

The tests expect a Redis server with the RedisBloom module loaded to be available at localhost:6379

Example Code

package main 

import (
        "fmt"
        redisbloom "github.com/RedisBloom/redisbloom-go"
)

func main() {
		// Connect to localhost with no password
    var client = redisbloom.NewClient("localhost:6379", "nohelp", nil)
       
    // BF.ADD mytest item 
    _, err := client.Add("mytest", "myItem")
    if err != nil {
        fmt.Println("Error:", err)
    }
    
    exists, err := client.Exists("mytest", "myItem")
    if err != nil {
        fmt.Println("Error:", err)
    }
    fmt.Println("myItem exists in mytest: ", exists)
}

Supported RedisBloom Commands

Bloom Filter

Command Recommended API and godoc
BF.RESERVE Reserve
BF.ADD Add
BF.MADD BfAddMulti
BF.INSERT N/A
BF.EXISTS Exists
BF.MEXISTS BfExistsMulti
BF.SCANDUMP BfScanDump
BF.LOADCHUNK BfLoadChunk
BF.INFO Info

Cuckoo Filter

Command Recommended API and godoc
CF.RESERVE CfReserve
CF.ADD CfAdd
CF.ADDNX CfAddNx
CF.INSERT CfInsert
CF.INSERTNX CfInsertNx
CF.EXISTS CfExists
CF.DEL CfDel
CF.COUNT CfCount
CF.SCANDUMP CfScanDump
CF.LOADCHUNK CfLoadChunk
CF.INFO CfInfo

Count-Min Sketch

Command Recommended API and godoc
CMS.INITBYDIM CmsInitByDim
CMS.INITBYPROB CmsInitByProb
CMS.INCRBY CmsIncrBy
CMS.QUERY CmsQuery
CMS.MERGE CmsMerge
CMS.INFO CmsInfo

TopK Filter

Command Recommended API and godoc
TOPK.RESERVE TopkReserve
TOPK.ADD TopkAdd
TOPK.INCRBY TopkIncrby
TOPK.QUERY TopkQuery
TOPK.COUNT TopkCount
TOPK.LIST TopkList
TOPK.INFO TopkInfo

License

redisbloom-go is distributed under the BSD 3-Clause license - see LICENSE