Skip to content

Commit 6295b63

Browse files
Update bloom-cuckoo.md
1 parent 983c9d9 commit 6295b63

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ds/prob/bloom-cuckoo.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Another use case is targeting ads to users. A per-user Bloom filter can be creat
1818
First, create a bloom filter and configure an acceptable false positive rate for your use case.
1919
You can also specify an initial capacity; the size of the dataset that you expect to add to the filter. Bloom filters can be configured to expand when this capacity is reached - [see the `BF.RESERVE` documentation for details](https://redis.io/commands/bf.reserve/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials).
2020

21-
```redis Create a Bloom filter
21+
```redis:[run_confirmation=true] Create a Bloom filter
2222
BF.RESERVE user:778:bought_products 0.001 50 // create new bloom filter at key "user:778:bought_products" with a desired false positive rate of 0.1% (0.001) and anticipated data set size of 50 entries
2323
```
2424

2525
Next, add some products for user 778.
2626

27-
```redis Add all bought product IDs to a Bloom filter
27+
```redis:[run_confirmation=true] Add all bought product IDs to a Bloom filter
2828
BF.MADD user:778:bought_products 4545667 9026875 3178945 4848754 1242449 // Add five items to user 778's list
2929
```
3030

@@ -44,7 +44,7 @@ BF.INFO user:778:bought_products // returns information about the bloom filter a
4444

4545
Inserting items into a Bloom filter that doesn't yet exist will create the filter for you.
4646

47-
```redis Create and add items simultaneously
47+
```redis:[run_confirmation=true] Create and add items simultaneously
4848
BF.INSERT bloomFilter ITEMS foo bar baz // creates the "bloomFilter" key and adds three items to it, if the filter does not already exist
4949
BF.INSERT newBloomFilter CAPACITY 10000 ITEMS hello waves goodbye // creates the "newBloomFilter" key and adds three items to it, if the filter does not already exist
5050
BF.INSERT bloomF NOCREATE ITEMS foo bar // tries to add 2 items to a filter with an error if the filter does not already exist
@@ -58,7 +58,7 @@ You can read more about Bloom filters and their use cases [here](https://redis.i
5858

5959
To begin, create a cuckoo filter with estimated capacity, defined bucket size (the number of items in each bucket), and maximum number of iterations (number of attempts to swap items between buckets).
6060

61-
```redis Create a cuckoo filter
61+
```redis:[run_confirmation=true] Create a cuckoo filter
6262
CF.RESERVE bikes:models 100 BUCKETSIZE 10 MAXITERATIONS 2 // creates a “cuckoo” filter for the initial amount of 100 items, 10 items per bucket and 2 iterations to swap items before creating an additional filter
6363
```
6464

@@ -68,7 +68,7 @@ CF.RESERVE bikes:models 100 BUCKETSIZE 10 MAXITERATIONS 2 // creates a “cuckoo
6868
Next, add items to the cuckoo filter.
6969
Note that `CF.ADD` creates a new filter if one doesn't already exist.
7070

71-
```redis Add Items
71+
```redis:[run_confirmation=true] Add Items
7272
CF.ADD bikes:models "Smokey Mountain Striker"
7373
CF.ADD bikes:models "Cloudy City Cruiser"
7474
CF.ADD bikes:models "Rocky Mountain Racer"
@@ -84,7 +84,7 @@ CF.EXISTS bikes:models "Non-existant model" // returns “0”, the item certain
8484

8585
Cuckoo filters support deletion. Here's an example.
8686

87-
```redis Delete an item
87+
```redis:[run_confirmation=true] Delete an item
8888
CF.DEL bikes:models "Smokey Mountain Striker" // delete the "Smokey Mountain Striker" item once from the filter
8989
```
9090

0 commit comments

Comments
 (0)