Skip to content

jsssk/bloom4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bloom4j

QuickStart

Import Maven dependency

<dependency>
    <groupId>io.github.jsssk</groupId>
    <artifactId>bloom4j</artifactId>
    <version>1.0.0.RELEASE</version>
</dependency>

Invoke

Default

    long numOfItems = 100_000_000;
    double fpp = 1e-4;
    BloomFilterParam param = BloomFilterParam.of(numOfItems, fpp);
    BloomFilter bloomFilter = DefaultBloomFilter.create(param);
    
    bloomFilter.put("foo".getBytes(StandardCharsets.UTF_8));

    bloomFilter.contains("foo".getBytes(StandardCharsets.UTF_8));

Scalable

    long numOfItems = 100_000_000;
    double fpp = 1e-4;
    long slotSize = 1 << 23; // 1 KB
    
    SlotStrategy slotStrategy = DefaultSlotStrategy.of(numOfItems, fpp, slotSize);
    BloomFilterHashStrategy strategy = BloomFilterHashStrategies.MURMUR128_MITZ_64;

    DefaultSlotBloomFilter.create(slotStrategy, strategy, (i, p) -> DefaultBloomFilter.create(strategy, p));
    ...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages