Package org.redisson.api
Interface RBloomFilter<T>
-
- Type Parameters:
T
- - type of object
- All Superinterfaces:
RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
- All Known Implementing Classes:
RedissonBloomFilter
public interface RBloomFilter<T> extends RExpirable
Distributed implementation of Bloom filter based on Highway 128-bit hash.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(T object)
Adds elementboolean
contains(T object)
Check for element presentlong
count()
Calculates probabilistic number of elements already added to Bloom filter.long
getExpectedInsertions()
Returns expected amount of insertions per element.double
getFalseProbability()
Returns false probability of element presence.int
getHashIterations()
Returns hash iterations amount used per element.long
getSize()
Returns number of bits in Redis memory required by this instanceboolean
tryInit(long expectedInsertions, double falseProbability)
Initializes Bloom filter params (size and hashIterations) calculated fromexpectedInsertions
andfalseProbability
Stores config to Redis server.-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
add
boolean add(T object)
Adds element- Parameters:
object
- - element to add- Returns:
true
if element has been added successfullyfalse
if element is already present
-
contains
boolean contains(T object)
Check for element present- Parameters:
object
- - element- Returns:
true
if element is presentfalse
if element is not present
-
tryInit
boolean tryInit(long expectedInsertions, double falseProbability)
Initializes Bloom filter params (size and hashIterations) calculated fromexpectedInsertions
andfalseProbability
Stores config to Redis server.- Parameters:
expectedInsertions
- - expected amount of insertions per elementfalseProbability
- - expected false probability- Returns:
true
if Bloom filter initializedfalse
if Bloom filter already has been initialized
-
getExpectedInsertions
long getExpectedInsertions()
Returns expected amount of insertions per element. Calculated during bloom filter initialization.- Returns:
- expected amount of insertions per element
-
getFalseProbability
double getFalseProbability()
Returns false probability of element presence. Calculated during bloom filter initialization.- Returns:
- false probability of element presence
-
getSize
long getSize()
Returns number of bits in Redis memory required by this instance- Returns:
- number of bits
-
getHashIterations
int getHashIterations()
Returns hash iterations amount used per element. Calculated during bloom filter initialization.- Returns:
- hash iterations amount
-
count
long count()
Calculates probabilistic number of elements already added to Bloom filter.- Returns:
- probabilistic number of elements
-
-