juanf/phpbloomfilter

PHP Bloom filter implementation with redis backing

v0.0.3 2015-12-16 14:17 UTC

This package is not auto-updated.

Last update: 2024-12-21 19:54:19 UTC


README

PHP Bloom filter with a Redis backend.

<?php

use JuanF\Lib\BloomFilter;

// Init Redis backend (others can be implemented).
$persistence = JuanF\Lib\Persistence\Redis::init();

// Instantiate filter.
$filter = new BloomFilter($persistence);

// Create a new filter, passing a key, bit size, hash count.
$filter->create('filter_key', 10000, 3);

$filter->add("the value");

if ($filter->has('the value')) {
	echo "maybe\n";
}
else {
	echo "not\n";
}