PHP code example of jacksmall / bloomfilter

1. Go to this page and download the library: Download jacksmall/bloomfilter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jacksmall / bloomfilter example snippets


use Jacksmall\Bloomfilter\Facades\BloomFilter;

// 添加元素
BloomFilter::add('[email protected]');
BloomFilter::addMany(['item1', 'item2']);

// 检查元素是否存在
if (BloomFilter::exists('[email protected]')) {
    // 可能存在(有误判概率)
} else {
    // 一定不存在
}

BloomFilter::connection('users')->add($user->id);
shell
php artisan vendor:publish --provider="Jacksmall\Bloomfilter\Providers\BloomfilterServiceProvider" --tag="bloomfilter-config"

'providers' => [
    ...
    \Jacksmall\Bloomfilter\Providers\BloomFilterServiceProvider::class
    ...
]