[go: up one dir, main page]

Skip to content

RedisBloom/JRedisBloom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license GitHub issues CircleCI Maven Central Javadocs Codecov Known Vulnerabilities

JRedisBloom

Forum Discord

A Java Client Library for RedisBloom

Deprecation notice

As of Jedis version 4.2.0, this library is deprecated. Its features have been merged into Jedis. Please either install it from maven or the repo

Overview

This project contains a Java library abstracting the API of the RedisBloom Redis module, that implements a high performance bloom filter with an easy-to-use API

See http://redisbloom.io for installation instructions of the module.

Official Releases

  <dependencies>
    <dependency>
      <groupId>com.redislabs</groupId>
      <artifactId>jrebloom</artifactId>
      <version>2.1.0</version>
    </dependency>
  </dependencies>

Snapshots

  <repositories>
    <repository>
      <id>snapshots-repo</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
  </repositories>

and

  <dependencies>
    <dependency>
      <groupId>com.redislabs</groupId>
      <artifactId>jrebloom</artifactId>
      <version>2.2.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

Usage example

Initializing the client:

import io.rebloom.client.Client

Client client = new Client("localhost", 6379);

Adding items to a bloom filter (created using default settings):

client.add("simpleBloom", "Mark");
// Does "Mark" now exist?
client.exists("simpleBloom", "Mark"); // true
client.exists("simpleBloom", "Farnsworth"); // False

Use multi-methods to add/check multiple items at once:

client.addMulti("simpleBloom", "foo", "bar", "baz", "bat", "bag");

// Check if they exist:
boolean[] rv = client.existsMulti("simpleBloom", "foo", "bar", "baz", "bat", "mark", "nonexist");

Reserve a customized bloom filter:

client.createFilter("specialBloom", 10000, 0.0001);
client.add("specialBloom", "foo");

Use cluster client to call redis cluster Initializing the cluster client:

Set<HostAndPort> jedisClusterNodes = new HashSet<>();
jedisClusterNodes.add(new HostAndPort("localhost", 7000));
ClusterClient cclient = new ClusterClient(jedisClusterNodes);

Adding items to a bloom filter (created using default settings):

cclient.add("simpleBloom", "Mark");
// Does "Mark" now exist?
cclient.exists("simpleBloom", "Mark"); // true
cclient.exists("simpleBloom", "Farnsworth"); // False

all method of ClusterClient is same to Client.