承接 zircote/bloom 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zircote/bloom

Composer 安装命令:

composer require zircote/bloom

包简介

A PHP/Redis Bloom filter experiment

README 文档

README

Build Status

This project has morphed from an attempt of 'pure' php bloom filters to a tool that employs Redis and Rediska as a storage and interface for a distributed Bloom Filter.

By utilizing the power of redis' SETBIT and GETBIT we are able to create a simple, powerful and lightweight bloomfilter. The ability of redis to create a BITSET that is practically endless in size 512MB the index limitations afforded us is huge. PHP_INT_MAX serves well as a line in the sand in this early stage of testing and research. This potentially results in a 3% false positive rate for 10b values given sufficient number of hashing buckets. (I am performing more on these numbers before I get overly confident on these findings.)

Read Times on Benchmarks: 0.0011499519820647/s with three key hashing using a word list of 27607 unique strings.

Add Times on benchmark tests: 0.0036964981654479/s with three key hashing using a word list of 27607 unique strings.

<?php
use Bloom\Filter,
    Bloom\Hash\HashMix,
    Bloom\Hash\Murmur,
    Rediska;

/* Create the Filter */
$filter = new Filter();
/* Inject Rediska */
$filter->setRediska(new Rediska());
/* Inject the Hash Class */
if(extension_loaded('murmurhash')){
    $filter->setHash(new Murmur());
} else {
    $filter->setHash(new HashMix());
}

/* Add items to the filter */
$filter->add('some random text');
$filter->add(array('or add','an array of elements'));

/* Check the filter */
var_dump($filter->contains('some random text'));
// bool(true)

var_dump($filter->contains('or add'));
// bool(true)

var_dump($filter->contains('This is not in the filter'));
// bool(false)


var_dump($filter->contains(array('or add','an array of elements')));
// bool(true)

var_dump($filter->contains(array('NO','or add','an array of elements')));
// bool(false)

Bitdeli Badge

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Apache2
  • 更新时间: 2012-11-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固