jacksmall / bloomfilter
laravel bloom filter
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jacksmall/bloomfilter
README
1.通过composer安装
composer require jacksmall/bloomfilter
2.发布配置文件
php artisan vendor:publish --provider="Jacksmall\Bloomfilter\Providers\BloomfilterServiceProvider" --tag="bloomfilter-config"
3.在本地项目config/app.php
'providers' => [
...
\Jacksmall\Bloomfilter\Providers\BloomFilterServiceProvider::class
...
]
4.使用
use Jacksmall\Bloomfilter\Facades\BloomFilter; // 添加元素 BloomFilter::add('user@example.com'); BloomFilter::addMany(['item1', 'item2']); // 检查元素是否存在 if (BloomFilter::exists('user@example.com')) { // 可能存在(有误判概率) } else { // 一定不存在 } BloomFilter::connection('users')->add($user->id);