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

1.0.2 2025-06-05 09:55 UTC

This package is auto-updated.

Last update: 2025-11-05 11:25:26 UTC


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);

😄😄