You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ds/prob/bloom-cuckoo.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -18,13 +18,13 @@ Another use case is targeting ads to users. A per-user Bloom filter can be creat
18
18
First, create a bloom filter and configure an acceptable false positive rate for your use case.
19
19
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).
20
20
21
-
```redis Create a Bloom filter
21
+
```redis:[run_confirmation=true] Create a Bloom filter
22
22
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
23
23
```
24
24
25
25
Next, add some products for user 778.
26
26
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
28
28
BF.MADD user:778:bought_products 4545667 9026875 3178945 4848754 1242449 // Add five items to user 778's list
29
29
```
30
30
@@ -44,7 +44,7 @@ BF.INFO user:778:bought_products // returns information about the bloom filter a
44
44
45
45
Inserting items into a Bloom filter that doesn't yet exist will create the filter for you.
46
46
47
-
```redis Create and add items simultaneously
47
+
```redis:[run_confirmation=true] Create and add items simultaneously
48
48
BF.INSERT bloomFilter ITEMS foo bar baz // creates the "bloomFilter" key and adds three items to it, if the filter does not already exist
49
49
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
50
50
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
58
58
59
59
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).
60
60
61
-
```redis Create a cuckoo filter
61
+
```redis:[run_confirmation=true] Create a cuckoo filter
62
62
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
0 commit comments