<?php //测试redis 布隆过滤器 $redis = new Redis(); $redis->connect('127.0.0.1', 6379); // 创建一个容量是1千万,布隆过滤器: //$redis->rawCommand('BF.RESERVE', 'nzc:redisbloom3', '0.0001', '10000000'); // 向布隆过滤器中添加元素: //$redis->rawCommand('BF.ADD', 'nzc:redisbloom3', 'element1998'); // 检查元素是否存在于布隆过滤器中: $res = $redis->rawCommand('BF.EXISTS', 'nzc:redisbloom3', 'element1998'); var_dump($res);//结果是1 /** [root@localhost sysconfig]# /usr/local/redis/bin/redis-cli -p 6379 127.0.0.1:6379> bf.reserve nzc:redisbloom1 0.01 10000000 OK 127.0.0.1:6379> bf.add nzc:redisbloom1 nzc1 (integer) 1 127.0.0.1:6379> bf.exists nzc:redisbloom1 nzc1 (integer) 1 127.0.0.1:6379> bf.exists nzc:redisbloom1 nzc2 (integer) 0 127.0.0.1:6379> bf.scandump nzc:redisbloom1 0 1) (integer) 1 */
标签:bf,127.0,0.1,redis,布隆,nzc,6379,php From: https://www.cnblogs.com/tochw/p/17528895.html