Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Requires the redis gem.
Adds Redis::Bloomfilter class which can be used as distributed bloom filter implementation on Redis.
A Bloom filter is a space-efficient probabilistic data structure that is used to test whether an element is a member of a set.
$ gem install redis-bloomfilter
$ bundle install
$ rake
The library contains a set of different drivers.
require "redis-bloomfilter"
# It creates a Bloom Filter using the default ruby driver
# Number of elements expected : 10000
# Max error rate: 1%
# Key name on Redis: my-bloom-filter
# Redis: 127.0.0.1:6379 or an already existing connection
@bf = Redis::Bloomfilter.new(
:size => 10_000,
:error_rate => 0.01,
:key_name => 'my-bloom-filter'
)
# Insert an element
@bf.insert "foo"
# Check if an element exists
puts @bf.include?("foo") # => true
puts @bf.include?("bar") # => false
# Empty the BF and delete the key stored on redis
@bf.clear
# Using Lua's driver: only available on Redis >= 2.6.0
# This driver should be prefered because is faster
@bf = Redis::Bloomfilter.new(
:size => 10_000,
:error_rate => 0.01,
:key_name => 'my-bloom-filter-lua',
:driver => 'lua'
)
# Specify a redis connection:
# @bf = Redis::Bloomfilter.new(
# :size => 10_000,
# :error_rate => 0.01,
# :key_name => 'my-bloom-filter-lua',
# :driver => 'lua',
# :redis => Redis.new(:host => "10.0.1.1", :port => 6380)
# )
---------------------------------------------
Benchmarking lua driver with 1000000 items
user system total real
insert: 38.620000 17.690000 56.310000 (160.377977)
include?: 43.420000 20.600000 64.020000 (175.055146)
---------------------------------------------
Benchmarking ruby driver with 1000000 items
user system total real
insert: 125.910000 20.250000 146.160000 (195.973994)
include?:121.230000 36.260000 157.490000 (231.360137)
The lua version is about ~3 times faster than the pure-Ruby version
Lua code is taken from https://github.com/ErikDubbelboer/redis-lua-scaling-bloom-filter
1.000.000 ~= 1.5Mb occupied on Redis
Copyright (c) 2013 Francesco Laurita. See LICENSE.txt for further details.
FAQs
Unknown package
We found that redis-bloomfilter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.