bloomfilter-redis-0.1.0.2: Distributed bloom filters on Redis (using the Hedis client).

Safe HaskellTrustworthy
LanguageHaskell2010

Data.RedisBloom

Contents

Description

A bloom filter for the Redis in-memory store.

Synopsis

Bloom filter configuration

Fundamental types

type Key = ByteString Source

Redis Key

Static bloom filter configuration

data Bloom a Source

Bloom filter static configuration. To use suggested values based on the desired false-positive rate and capacity, use suggestCreate.

Constructors

Bloom 

Fields

key :: !Key

The key to store the bloom filter under.

capacity :: !Capacity

Bloom filter capacity, i.e. the number of bits used.

hf :: HashFamily a

The hash family associated with the bloom filter. See hashFamilyFNV and hashFamilySimple

Bloom filter operations

createBF :: RedisCtx m (Either Reply) => Bloom a -> m (Either Reply Status) Source

Create a new bloom filter with the specified configuration.

createIfNewBF :: RedisCtx m (Either Reply) => Bloom a -> m (Either Reply Bool) Source

Create a new bloom filter with the specified configuration if the specified key does not yet exist.

addBF :: RedisCtx m f => Bloom a -> a -> m () Source

Add an element to an existing bloom filter.

queryBF :: (MonadRedis m, RedisCtx m (Either Reply)) => Bloom a -> a -> m Bool Source

Query whether an element exists in the bloom filter.

Gracefully fails upon failure by returning False.