@@ -4,9 +4,9 @@ Valkey-Bloom (BSD-3-Clause) is a Rust Valkey-Module which brings a native and sp
4
4
5
5
Valkey-Bloom is built using bloomfilter::Bloom (https://crates.io/crates/bloomfilter which has a BSD-2-Clause license).
6
6
7
- It is compatible with the BloomFilter (BF.* ) command APIs of the ReBloom Module from Redis Ltd .
7
+ It is compatible with the BloomFilter (BF.* ) command APIs in Redis offerings .
8
8
9
- The following commands are supported.
9
+ ## Supported commands
10
10
```
11
11
BF.EXISTS
12
12
BF.ADD
@@ -19,99 +19,45 @@ BF.INSERT
19
19
BF.LOAD
20
20
```
21
21
22
- Build instructions for Linux.
22
+ ## Build instructions
23
23
```
24
24
curl https://sh.rustup.rs -sSf | sh
25
25
sudo yum install clang
26
- git clone https://github.com/KarthikSubbarao /valkey-bloom.git
26
+ git clone https://github.com/valkey-io /valkey-bloom.git
27
27
cd valkey-bloom
28
28
cargo build --all --all-targets --release
29
29
valkey-server --loadmodule ./target/release/libvalkey_bloom.so
30
30
```
31
31
32
- Local development script to build, run format checks, run unit / integration tests, and for cargo release:
32
+ #### Local development script to build, run format checks, run unit / integration tests, and for cargo release:
33
33
```
34
34
# Builds the valkey-server (unstable) for integration testing.
35
35
SERVER_VERSION=unstable
36
36
./build.sh
37
- # Builds the valkey-server (8.0.0) for integration testing.
37
+ # Same as above, but uses valkey-server (8.0.0) for integration testing.
38
38
SERVER_VERSION=8.0.0
39
39
./build.sh
40
40
```
41
41
42
- Client Usage
43
- ```
44
- <redacted> % ./valkey-cli
45
- 127.0.0.1:6379> module list
46
- 1) 1) "name"
47
- 2) "bloom"
48
- 3) "ver"
49
- 4) (integer) 1
50
- 5) "path"
51
- 6) "./target/release/libvalkey_bloom.so"
52
- 7) "args"
53
- 8) (empty array)
54
- 127.0.0.1:6379> bf.add key item
55
- (integer) 1
56
- 127.0.0.1:6379> bf.exists key item
57
- (integer) 1
58
- 127.0.0.1:6379> bf.exists key item2
59
- (integer) 0
60
- 127.0.0.1:6379> bf.card key
61
- (integer) 1
62
- 127.0.0.1:6379> bf.reserve key 0.01 10000
63
- (error) ERR item exists
64
- 127.0.0.1:6379> bf.reserve key1 0.01 10000
65
- OK
66
- 127.0.0.1:6379> bf.card key1
67
- (integer) 0
68
- 127.0.0.1:6379> bf.add key1 item
69
- (integer) 1
70
- 127.0.0.1:6379> bf.card key1
71
- (integer) 1
72
- ```
42
+ ## Load the Module
43
+ To test the module with a Valkey, you can load the module in the following ways:
73
44
45
+ #### Using valkey.conf:
74
46
```
75
- 127.0.0.1:6379> bf.reserve key1 0.01 10000
76
- OK
77
- 127.0.0.1:6379> bf.info key3
78
- (empty array)
79
- 127.0.0.1:6379> bf.info key1
80
- 1) Capacity
81
- 2) (integer) 10000
82
- 3) Size
83
- 4) (integer) 12198
84
- 5) Number of filters
85
- 6) (integer) 1
86
- 7) Number of items inserted
87
- 8) (integer) 0
88
- 9) Expansion rate
89
- 10) (integer) 2
47
+ 1. Add the following to valkey.conf:
48
+ loadmodule /path/to/libvalkey_bloom.so
49
+ 2. Start valkey-server:
50
+ valkey-server /path/to/valkey.conf
90
51
```
91
52
92
- RDB Load, Save and flushall validation
53
+ #### Starting Valkey with the ` --loadmodule ` option:
54
+ ``` text
55
+ valkey-server --loadmodule /path/to/libvalkey_bloom.so
93
56
```
94
- 127.0.0.1:6379> info keyspace
95
- # Keyspace
96
- 127.0.0.1:6379> bf.add key item
97
- (integer) 1
98
- 127.0.0.1:6379> info keyspace
99
- # Keyspace
100
- db0:keys=1,expires=0,avg_ttl=0
101
- 127.0.0.1:6379> flushall
102
- OK
103
- 127.0.0.1:6379> info keyspace
104
- # Keyspace
105
- 127.0.0.1:6379> bf.add key item
106
- (integer) 1
107
- 127.0.0.1:6379> bgsave
108
- Background saving started
109
- 127.0.0.1:6379> shutdown
110
- not connected> info keyspace // Started up
111
- # Keyspace
112
- db0:keys=1,expires=0,avg_ttl=0
113
- 127.0.0.1:6379> keys *
114
- 1) "key"
115
- 127.0.0.1:6379> bf.exists key item
116
- (integer) 1
57
+
58
+ #### Using the Valkey command ` MODULE LOAD ` :
117
59
```
60
+ 1. Connect to a running Valkey instance using valkey-cli
61
+ 2. Execute Valkey command:
62
+ MODULE LOAD /path/to/libvalkey_bloom.so
63
+ ```
0 commit comments