New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inability to have multiple bloom filters stored in redis? #3
Comments
Hi, thanks for raising the issue. The problem you describe is in fact present, as every Bloomfilter will use the same keys. I will fix it soon. |
Cool, thanks! |
I have submitted a pull request with this feature (Scott and I work together). |
The feature is now implemented using the Builder, Bloom filter can now be assigned names, that will be used to distinguish them: String host = "localhost";
int port = 6379;
String filterName = "normalbloomfilter";
//Open a Redis-backed Bloom filter
BloomFilter<String> bfr = new FilterBuilder(1000, 0.01)
.name(filterName) //use a distinct name
.redisBacked(true)
.redisHost(host) //Default is localhost
.redisPort(port) //Default is standard 6379
.buildBloomFilter();
bfr.add("cow");
//Open the same Bloom filter from anywhere else
BloomFilter<String> bfr2 = new FilterBuilder(1000, 0.01)
.name(filterName) //load the same filter
.redisBacked(true)
.buildBloomFilter();
bfr2.add("bison");
print(bfr.contains("cow")); //true
print(bfr.contains("bison")); //true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I'm attempting to use your Redis backed bloomfilter, but it appears that it always stores the filter under a hardcoded key called "normalbloomfilter". How can I have a second bloom filter without overwriting the first one?
The text was updated successfully, but these errors were encountered: