tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

Bloom Filter Module Family

下载
聚焦模式
字号
最后更新时间: 2026-08-11 11:12:00
本文档由 AI 翻译

Command Introduction

The Bloom Filter Module (valkey-bloom) provides a probabilistic data structure for efficiently determining whether an element may be present in a set. This module is suitable for big data scenarios such as cache penetration protection, URL deduplication, user recommendation deduplication, traffic anomaly detection, and real-time quantile monitoring. This module is supported starting from Valkey 8.0 and is not part of the Redis core command set.
BF.RESERVE: Creates a Bloom filter and specifies its capacity and error rate.
BF.ADD / BF.MADD: Adds a single element or multiple elements.
BF.EXISTS / BF.MEXISTS: Checks whether a single element or multiple elements may be present (a non-existent result is always correct, while a present result may be a false positive).
BF.CARD: Obtains an estimated number of the unique elements that have been added.
BF.INFO: Views information about the filter, such as its capacity, the number of elements added, and the error rate.
BF.INSERT: Creates a filter with initial elements, combining the features of RESERVE and ADD.
BF.LOAD: Is used for Bloom filter restoration during AOF rewriting.
For more information, see the Valkey official documentation: valkey-bloom module.

Command Support Overview

Basic Read/Write Commands: BF.ADD, BF.MADD, BF.EXISTS, BF.MEXISTS, and BF.CARD. These commands are used to add an element to a Bloom filter, add elements in batches, check whether an element exists, check for existence in batches, and obtain an estimated number of unique elements added. Both the Valkey 8.0 standard architecture and cluster architecture support them. Among these, BF.ADD and BF.MADD automatically create a filter with default parameters when the filter does not exist.
Filter Management Commands: BF.RESERVE, BF.INSERT, and BF.INFO. These commands are used to create an empty Bloom filter with specified attributes (where the error rate and capacity can be preset), create a filter with initial elements, and view the filter's usage information and attributes. Both the Valkey 8.0 standard architecture and cluster architecture support them.
Persistence Command: BF.LOAD. It is used for Bloom filter restoration during AOF rewriting. Both the Valkey 8.0 standard architecture and cluster architecture support it.
Cross-Slot Restriction: All Bloom Filter commands operate on a single Bloom filter key, adhere to the standard key routing rules, and have no cross-slot restriction.

Command Compatibility Matrix

Note:
The Bloom Filter Module is a Valkey-exclusive extension module and is not a Redis core feature. Therefore, it is not supported by any Redis edition. All commands operate on a single key. In a cluster architecture, they are distributed according to the standard key routing rules and have no cross-slot limitation.
Command
Valkey 9.0 Standard Architecture
Valkey 9.0 Cluster Architecture
Valkey 8.0 Standard Architecture
Valkey 8.0 Cluster Architecture
bf.add
✓
✓
✓
✓
bf.madd
✓
✓
✓
✓
bf.exists
✓
✓
✓
✓
bf.mexists
✓
✓
✓
✓
bf.card
✓
✓
✓
✓
bf.reserve
✓
✓
✓
✓
bf.insert
✓
✓
✓
✓
bf.info
✓
✓
✓
✓
bf.load
✓
✓
✓
✓

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈