Skip to content

damikem/redisbloom-go

 
 

Repository files navigation

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:

$ go test

The tests expect a Redis server with the RedisBloom module loaded to be available at localhost:6379. You can easily launch RedisBloom with Docker in the following manner:

docker run -d -p 6379:6379 --name redis-redisbloom redislabs/rebloom:latest 

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 BfInsert
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

About

Go Client for RedisBloom probabilistic module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.2%
  • Makefile 1.8%