protocol-redis 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -2
- data/context/getting-started.md +55 -0
- data/context/index.yaml +13 -0
- data/lib/protocol/redis/cluster/methods/generic.rb +94 -0
- data/lib/protocol/redis/cluster/methods/pubsub.rb +27 -0
- data/lib/protocol/redis/cluster/methods/scripting.rb +93 -0
- data/lib/protocol/redis/cluster/methods/streams.rb +204 -0
- data/lib/protocol/redis/cluster/methods/strings.rb +304 -0
- data/lib/protocol/redis/cluster/methods.rb +27 -0
- data/lib/protocol/redis/connection.rb +41 -12
- data/lib/protocol/redis/error.rb +6 -0
- data/lib/protocol/redis/methods/cluster.rb +9 -7
- data/lib/protocol/redis/methods/connection.rb +9 -8
- data/lib/protocol/redis/methods/counting.rb +9 -8
- data/lib/protocol/redis/methods/generic.rb +100 -99
- data/lib/protocol/redis/methods/geospatial.rb +42 -49
- data/lib/protocol/redis/methods/hashes.rb +84 -83
- data/lib/protocol/redis/methods/lists.rb +75 -74
- data/lib/protocol/redis/methods/pubsub.rb +5 -4
- data/lib/protocol/redis/methods/scripting.rb +19 -20
- data/lib/protocol/redis/methods/server.rb +13 -9
- data/lib/protocol/redis/methods/sets.rb +42 -41
- data/lib/protocol/redis/methods/sorted_sets.rb +110 -109
- data/lib/protocol/redis/methods/streams.rb +48 -47
- data/lib/protocol/redis/methods/strings.rb +112 -109
- data/lib/protocol/redis/methods.rb +16 -14
- data/lib/protocol/redis/version.rb +1 -1
- data/lib/protocol/redis.rb +9 -2
- data/readme.md +49 -21
- data/releases.md +98 -0
- data.tar.gz.sig +0 -0
- metadata +13 -9
- metadata.gz.sig +0 -0
@@ -6,115 +6,116 @@
|
|
6
6
|
module Protocol
|
7
7
|
module Redis
|
8
8
|
module Methods
|
9
|
+
# Methods for managing Redis streams.
|
9
10
|
module Streams
|
10
11
|
# Get information on streams and consumer groups. O(N) with N being the number of returned items for the subcommands CONSUMERS and GROUPS. The STREAM subcommand is O(log N) with N being the number of items in the stream.
|
11
|
-
#
|
12
|
-
# @
|
12
|
+
# See <https://redis.io/commands/xinfo> for more details.
|
13
|
+
# @parameter help [Enum]
|
13
14
|
def xinfo(*arguments)
|
14
15
|
call("XINFO", *arguments)
|
15
16
|
end
|
16
17
|
|
17
18
|
# Appends a new entry to a stream. O(1).
|
18
|
-
#
|
19
|
-
# @
|
20
|
-
# @
|
19
|
+
# See <https://redis.io/commands/xadd> for more details.
|
20
|
+
# @parameter key [Key]
|
21
|
+
# @parameter ID [String]
|
21
22
|
def xadd(*arguments)
|
22
23
|
call("XADD", *arguments)
|
23
24
|
end
|
24
25
|
|
25
26
|
# Trims the stream to (approximately if '~' is passed) a certain size. O(N), with N being the number of evicted entries. Constant times are very small however, since entries are organized in macro nodes containing multiple entries that can be released with a single deallocation.
|
26
|
-
#
|
27
|
-
# @
|
28
|
-
# @
|
29
|
-
# @
|
30
|
-
# @
|
27
|
+
# See <https://redis.io/commands/xtrim> for more details.
|
28
|
+
# @parameter key [Key]
|
29
|
+
# @parameter strategy [Enum]
|
30
|
+
# @parameter approx [Enum]
|
31
|
+
# @parameter count [Integer]
|
31
32
|
def xtrim(*arguments)
|
32
33
|
call("XTRIM", *arguments)
|
33
34
|
end
|
34
35
|
|
35
36
|
# Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist. O(1) for each single item to delete in the stream, regardless of the stream size.
|
36
|
-
#
|
37
|
-
# @
|
38
|
-
# @
|
37
|
+
# See <https://redis.io/commands/xdel> for more details.
|
38
|
+
# @parameter key [Key]
|
39
|
+
# @parameter ID [String]
|
39
40
|
def xdel(*arguments)
|
40
41
|
call("XDEL", *arguments)
|
41
42
|
end
|
42
43
|
|
43
44
|
# Return a range of elements in a stream, with IDs matching the specified IDs interval. O(N) with N being the number of elements being returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).
|
44
|
-
#
|
45
|
-
# @
|
46
|
-
# @
|
47
|
-
# @
|
45
|
+
# See <https://redis.io/commands/xrange> for more details.
|
46
|
+
# @parameter key [Key]
|
47
|
+
# @parameter start [String]
|
48
|
+
# @parameter end [String]
|
48
49
|
def xrange(*arguments)
|
49
50
|
call("XRANGE", *arguments)
|
50
51
|
end
|
51
52
|
|
52
53
|
# Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE. O(N) with N being the number of elements returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).
|
53
|
-
#
|
54
|
-
# @
|
55
|
-
# @
|
56
|
-
# @
|
54
|
+
# See <https://redis.io/commands/xrevrange> for more details.
|
55
|
+
# @parameter key [Key]
|
56
|
+
# @parameter end [String]
|
57
|
+
# @parameter start [String]
|
57
58
|
def xrevrange(*arguments)
|
58
59
|
call("XREVRANGE", *arguments)
|
59
60
|
end
|
60
61
|
|
61
62
|
# Return the number of entires in a stream. O(1).
|
62
|
-
#
|
63
|
-
# @
|
63
|
+
# See <https://redis.io/commands/xlen> for more details.
|
64
|
+
# @parameter key [Key]
|
64
65
|
def xlen(*arguments)
|
65
66
|
call("XLEN", *arguments)
|
66
67
|
end
|
67
68
|
|
68
69
|
# Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block. For each stream mentioned: O(N) with N being the number of elements being returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when the BLOCK option is used, XADD will pay O(M) time in order to serve the M clients blocked on the stream getting new data.
|
69
|
-
#
|
70
|
-
# @
|
71
|
-
# @
|
72
|
-
# @
|
70
|
+
# See <https://redis.io/commands/xread> for more details.
|
71
|
+
# @parameter streams [Enum]
|
72
|
+
# @parameter key [Key]
|
73
|
+
# @parameter id [String]
|
73
74
|
def xread(*arguments)
|
74
75
|
call("XREAD", *arguments)
|
75
76
|
end
|
76
77
|
|
77
78
|
# Create, destroy, and manage consumer groups. O(1) for all the subcommands, with the exception of the DESTROY subcommand which takes an additional O(M) time in order to delete the M entries inside the consumer group pending entries list (PEL).
|
78
|
-
#
|
79
|
+
# See <https://redis.io/commands/xgroup> for more details.
|
79
80
|
def xgroup(*arguments)
|
80
81
|
call("XGROUP", *arguments)
|
81
82
|
end
|
82
83
|
|
83
84
|
# Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block. For each stream mentioned: O(M) with M being the number of elements returned. If M is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data.
|
84
|
-
#
|
85
|
-
# @
|
86
|
-
# @
|
87
|
-
# @
|
88
|
-
# @
|
85
|
+
# See <https://redis.io/commands/xreadgroup> for more details.
|
86
|
+
# @parameter noack [Enum]
|
87
|
+
# @parameter streams [Enum]
|
88
|
+
# @parameter key [Key]
|
89
|
+
# @parameter ID [String]
|
89
90
|
def xreadgroup(*arguments)
|
90
91
|
call("XREADGROUP", *arguments)
|
91
92
|
end
|
92
93
|
|
93
94
|
# Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL. O(1) for each message ID processed.
|
94
|
-
#
|
95
|
-
# @
|
96
|
-
# @
|
97
|
-
# @
|
95
|
+
# See <https://redis.io/commands/xack> for more details.
|
96
|
+
# @parameter key [Key]
|
97
|
+
# @parameter group [String]
|
98
|
+
# @parameter ID [String]
|
98
99
|
def xack(*arguments)
|
99
100
|
call("XACK", *arguments)
|
100
101
|
end
|
101
102
|
|
102
103
|
# Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer. O(log N) with N being the number of messages in the PEL of the consumer group.
|
103
|
-
#
|
104
|
-
# @
|
105
|
-
# @
|
106
|
-
# @
|
107
|
-
# @
|
108
|
-
# @
|
104
|
+
# See <https://redis.io/commands/xclaim> for more details.
|
105
|
+
# @parameter key [Key]
|
106
|
+
# @parameter group [String]
|
107
|
+
# @parameter consumer [String]
|
108
|
+
# @parameter min-idle-time [String]
|
109
|
+
# @parameter ID [String]
|
109
110
|
def xclaim(*arguments)
|
110
111
|
call("XCLAIM", *arguments)
|
111
112
|
end
|
112
113
|
|
113
114
|
# Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged. O(N) with N being the number of elements returned, so asking for a small fixed number of entries per call is O(1). When the command returns just the summary it runs in O(1) time assuming the list of consumers is small, otherwise there is additional O(N) time needed to iterate every consumer.
|
114
|
-
#
|
115
|
-
# @
|
116
|
-
# @
|
117
|
-
# @
|
115
|
+
# See <https://redis.io/commands/xpending> for more details.
|
116
|
+
# @parameter key [Key]
|
117
|
+
# @parameter group [String]
|
118
|
+
# @parameter consumer [String]
|
118
119
|
def xpending(*arguments)
|
119
120
|
call("XPENDING", *arguments)
|
120
121
|
end
|
@@ -6,191 +6,194 @@
|
|
6
6
|
module Protocol
|
7
7
|
module Redis
|
8
8
|
module Methods
|
9
|
+
# Methods for managing Redis strings.
|
9
10
|
module Strings
|
10
11
|
# Append a value to a key. O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
|
11
|
-
#
|
12
|
-
# @
|
13
|
-
# @
|
12
|
+
# See <https://redis.io/commands/append> for more details.
|
13
|
+
# @parameter key [Key]
|
14
|
+
# @parameter value [String]
|
14
15
|
def append(key, value)
|
15
|
-
call(
|
16
|
+
call("APPEND", key, value)
|
16
17
|
end
|
17
|
-
|
18
|
+
|
18
19
|
# Count set bits in a string. O(N).
|
19
|
-
#
|
20
|
-
# @
|
20
|
+
# See <https://redis.io/commands/bitcount> for more details.
|
21
|
+
# @parameter key [Key]
|
21
22
|
def bitcount(key, *range)
|
22
|
-
call(
|
23
|
+
call("BITCOUNT", key, *range)
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
# Decrement the integer value of a key by one. O(1).
|
26
|
-
#
|
27
|
-
# @
|
27
|
+
# See <https://redis.io/commands/decr> for more details.
|
28
|
+
# @parameter key [Key]
|
28
29
|
def decr(key)
|
29
|
-
call(
|
30
|
+
call("DECR", key)
|
30
31
|
end
|
31
|
-
|
32
|
+
|
32
33
|
# Decrement the integer value of a key by the given number. O(1).
|
33
|
-
#
|
34
|
-
# @
|
35
|
-
# @
|
34
|
+
# See <https://redis.io/commands/decrby> for more details.
|
35
|
+
# @parameter key [Key]
|
36
|
+
# @parameter decrement [Integer]
|
36
37
|
def decrby(key, decrement)
|
37
|
-
call(
|
38
|
+
call("DECRBY", key, decrement)
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
# Get the value of a key. O(1).
|
41
|
-
#
|
42
|
-
# @
|
42
|
+
# See <https://redis.io/commands/get> for more details.
|
43
|
+
# @parameter key [Key]
|
43
44
|
def get(key)
|
44
|
-
call(
|
45
|
+
call("GET", key)
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
# Returns the bit value at offset in the string value stored at key. O(1).
|
48
|
-
#
|
49
|
-
# @
|
50
|
-
# @
|
49
|
+
# See <https://redis.io/commands/getbit> for more details.
|
50
|
+
# @parameter key [Key]
|
51
|
+
# @parameter offset [Integer]
|
51
52
|
def getbit(key, offset)
|
52
|
-
call(
|
53
|
+
call("GETBIT", key, offset)
|
53
54
|
end
|
54
|
-
|
55
|
+
|
55
56
|
# Get a substring of the string stored at a key. O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.
|
56
|
-
#
|
57
|
-
# @
|
58
|
-
# @
|
59
|
-
# @
|
57
|
+
# See <https://redis.io/commands/getrange> for more details.
|
58
|
+
# @parameter key [Key]
|
59
|
+
# @parameter start [Integer]
|
60
|
+
# @parameter end [Integer]
|
60
61
|
def getrange(key, start_index, end_index)
|
61
|
-
call(
|
62
|
+
call("GETRANGE", key, start_index, end_index)
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
# Set the string value of a key and return its old value. O(1).
|
65
|
-
#
|
66
|
-
# @
|
67
|
-
# @
|
66
|
+
# See <https://redis.io/commands/getset> for more details.
|
67
|
+
# @parameter key [Key]
|
68
|
+
# @parameter value [String]
|
68
69
|
def getset(key, value)
|
69
|
-
call(
|
70
|
+
call("GETSET", key, value)
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
# Increment the integer value of a key by one. O(1).
|
73
|
-
#
|
74
|
-
# @
|
74
|
+
# See <https://redis.io/commands/incr> for more details.
|
75
|
+
# @parameter key [Key]
|
75
76
|
def incr(key)
|
76
|
-
call(
|
77
|
+
call("INCR", key)
|
77
78
|
end
|
78
|
-
|
79
|
+
|
79
80
|
# Increment the integer value of a key by the given amount. O(1).
|
80
|
-
#
|
81
|
-
# @
|
82
|
-
# @
|
81
|
+
# See <https://redis.io/commands/incrby> for more details.
|
82
|
+
# @parameter key [Key]
|
83
|
+
# @parameter increment [Integer]
|
83
84
|
def incrby(key, increment)
|
84
|
-
call(
|
85
|
+
call("INCRBY", key, increment)
|
85
86
|
end
|
86
|
-
|
87
|
+
|
87
88
|
# Increment the float value of a key by the given amount. O(1).
|
88
|
-
#
|
89
|
-
# @
|
90
|
-
# @
|
89
|
+
# See <https://redis.io/commands/incrbyfloat> for more details.
|
90
|
+
# @parameter key [Key]
|
91
|
+
# @parameter increment [Double]
|
91
92
|
def incrbyfloat(key, increment)
|
92
|
-
call(
|
93
|
+
call("INCRBYFLOAT", key, increment)
|
93
94
|
end
|
94
|
-
|
95
|
+
|
95
96
|
# Get the values of all the given keys. O(N) where N is the number of keys to retrieve.
|
96
|
-
#
|
97
|
-
# @
|
97
|
+
# See <https://redis.io/commands/mget> for more details.
|
98
|
+
# @parameter key [Key]
|
98
99
|
def mget(key, *keys)
|
99
|
-
call(
|
100
|
+
call("MGET", key, *keys)
|
100
101
|
end
|
101
|
-
|
102
|
+
|
102
103
|
# Set multiple keys to multiple values. O(N) where N is the number of keys to set.
|
103
|
-
#
|
104
|
+
# See <https://redis.io/commands/mset> for more details.
|
104
105
|
def mset(pairs)
|
105
|
-
|
106
|
+
if pairs.is_a?(Hash)
|
107
|
+
pairs = pairs.to_a.flatten
|
108
|
+
end
|
106
109
|
|
107
|
-
call(
|
110
|
+
call("MSET", *pairs)
|
108
111
|
end
|
109
|
-
|
112
|
+
|
110
113
|
# Set multiple keys to multiple values, only if none of the keys exist. O(N) where N is the number of keys to set.
|
111
|
-
#
|
114
|
+
# See <https://redis.io/commands/msetnx> for more details.
|
112
115
|
def msetnx(pairs)
|
113
116
|
flattened_pairs = pairs.keys.zip(pairs.values).flatten
|
114
117
|
|
115
|
-
call(
|
118
|
+
call("MSETNX", *flattened_pairs)
|
116
119
|
end
|
117
|
-
|
120
|
+
|
118
121
|
# Set the value and expiration in milliseconds of a key. O(1).
|
119
|
-
#
|
120
|
-
# @
|
121
|
-
# @
|
122
|
-
# @
|
122
|
+
# See <https://redis.io/commands/psetex> for more details.
|
123
|
+
# @parameter key [Key]
|
124
|
+
# @parameter milliseconds [Integer]
|
125
|
+
# @parameter value [String]
|
123
126
|
def psetex(key, milliseconds, value)
|
124
|
-
call(
|
127
|
+
call("PSETEX", key, milliseconds, value)
|
125
128
|
end
|
126
|
-
|
129
|
+
|
127
130
|
# Set the string value of a key. O(1).
|
128
|
-
#
|
129
|
-
# @
|
130
|
-
# @
|
131
|
-
# @
|
132
|
-
# @
|
131
|
+
# See <https://redis.io/commands/set> for more details.
|
132
|
+
# @parameter key [Key]
|
133
|
+
# @parameter value [String]
|
134
|
+
# @parameter expiration [Enum]
|
135
|
+
# @parameter update [Boolean, nil] If true, only update elements that already exist (never add elements). If false, don't update existing elements (only add new elements).
|
133
136
|
def set(key, value, update: nil, seconds: nil, milliseconds: nil)
|
134
137
|
arguments = []
|
135
|
-
|
138
|
+
|
136
139
|
if seconds
|
137
|
-
arguments <<
|
140
|
+
arguments << "EX" << seconds
|
138
141
|
end
|
139
|
-
|
142
|
+
|
140
143
|
if milliseconds
|
141
|
-
arguments <<
|
144
|
+
arguments << "PX" << milliseconds
|
142
145
|
end
|
143
|
-
|
146
|
+
|
144
147
|
if update == true
|
145
148
|
arguments << "XX"
|
146
149
|
elsif update == false
|
147
150
|
arguments << "NX"
|
148
151
|
end
|
149
|
-
|
150
|
-
call(
|
152
|
+
|
153
|
+
call("SET", key, value, *arguments)
|
151
154
|
end
|
152
|
-
|
155
|
+
|
153
156
|
# Sets or clears the bit at offset in the string value stored at key. O(1).
|
154
|
-
#
|
155
|
-
# @
|
156
|
-
# @
|
157
|
-
# @
|
157
|
+
# See <https://redis.io/commands/setbit> for more details.
|
158
|
+
# @parameter key [Key]
|
159
|
+
# @parameter offset [Integer]
|
160
|
+
# @parameter value [Integer]
|
158
161
|
def setbit(key, offset, value)
|
159
|
-
call(
|
162
|
+
call("SETBIT", key, offset, value)
|
160
163
|
end
|
161
|
-
|
164
|
+
|
162
165
|
# Set the value and expiration of a key. O(1).
|
163
|
-
#
|
164
|
-
# @
|
165
|
-
# @
|
166
|
-
# @
|
166
|
+
# See <https://redis.io/commands/setex> for more details.
|
167
|
+
# @parameter key [Key]
|
168
|
+
# @parameter seconds [Integer]
|
169
|
+
# @parameter value [String]
|
167
170
|
def setex(key, seconds, value)
|
168
|
-
call(
|
171
|
+
call("SETEX", key, seconds, value)
|
169
172
|
end
|
170
|
-
|
173
|
+
|
171
174
|
# Set the value of a key, only if the key does not exist. O(1).
|
172
|
-
# @
|
173
|
-
#
|
174
|
-
# @
|
175
|
-
# @
|
175
|
+
# @returns [Boolean] if the key was set.
|
176
|
+
# See <https://redis.io/commands/setnx> for more details.
|
177
|
+
# @parameter key [Key]
|
178
|
+
# @parameter value [String]
|
176
179
|
def setnx(key, value)
|
177
|
-
call(
|
180
|
+
call("SETNX", key, value) == 1
|
178
181
|
end
|
179
|
-
|
182
|
+
|
180
183
|
# Overwrite part of a string at key starting at the specified offset. O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the value argument.
|
181
|
-
#
|
182
|
-
# @
|
183
|
-
# @
|
184
|
-
# @
|
184
|
+
# See <https://redis.io/commands/setrange> for more details.
|
185
|
+
# @parameter key [Key]
|
186
|
+
# @parameter offset [Integer]
|
187
|
+
# @parameter value [String]
|
185
188
|
def setrange(key, offset, value)
|
186
|
-
call(
|
189
|
+
call("SETRANGE", key, offset, value)
|
187
190
|
end
|
188
|
-
|
191
|
+
|
189
192
|
# Get the length of the value stored in a key. O(1).
|
190
|
-
#
|
191
|
-
# @
|
193
|
+
# See <https://redis.io/commands/strlen> for more details.
|
194
|
+
# @parameter key [Key]
|
192
195
|
def strlen(key)
|
193
|
-
call(
|
196
|
+
call("STRLEN", key)
|
194
197
|
end
|
195
198
|
end
|
196
199
|
end
|
@@ -6,27 +6,29 @@
|
|
6
6
|
# Copyright, 2021, by Daniel Evans.
|
7
7
|
# Copyright, 2023, by Nick Burwell.
|
8
8
|
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
9
|
+
require_relative "methods/generic"
|
10
|
+
require_relative "methods/connection"
|
11
|
+
require_relative "methods/server"
|
12
|
+
require_relative "methods/cluster"
|
13
|
+
require_relative "methods/geospatial"
|
14
14
|
|
15
|
-
require_relative
|
15
|
+
require_relative "methods/counting"
|
16
16
|
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
21
|
-
require_relative
|
22
|
-
require_relative
|
23
|
-
require_relative
|
17
|
+
require_relative "methods/hashes"
|
18
|
+
require_relative "methods/lists"
|
19
|
+
require_relative "methods/scripting"
|
20
|
+
require_relative "methods/sets"
|
21
|
+
require_relative "methods/strings"
|
22
|
+
require_relative "methods/streams"
|
23
|
+
require_relative "methods/sorted_sets"
|
24
24
|
|
25
|
-
require_relative
|
25
|
+
require_relative "methods/pubsub"
|
26
26
|
|
27
27
|
module Protocol
|
28
28
|
module Redis
|
29
|
+
# A collection of methods for interacting with Redis.
|
29
30
|
module Methods
|
31
|
+
# Includes all Redis methods into the given class.
|
30
32
|
def self.included(klass)
|
31
33
|
klass.include Methods::Generic
|
32
34
|
klass.include Methods::Connection
|
data/lib/protocol/redis.rb
CHANGED
@@ -3,5 +3,12 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2023, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "redis/version"
|
7
|
+
require_relative "redis/connection"
|
8
|
+
|
9
|
+
# @namespace
|
10
|
+
module Protocol
|
11
|
+
# @namespace
|
12
|
+
module Redis
|
13
|
+
end
|
14
|
+
end
|
data/readme.md
CHANGED
@@ -4,40 +4,68 @@ Implements the RESP2 and [RESP3](https://github.com/antirez/RESP3) Redis protoco
|
|
4
4
|
|
5
5
|
[](https://github.com/socketry/protocol-redis/actions?workflow=Test)
|
6
6
|
|
7
|
-
##
|
7
|
+
## Usage
|
8
8
|
|
9
|
-
|
9
|
+
Please see the [project documentation](https://socketry.github.io/protocol-redis/) for more details.
|
10
10
|
|
11
|
-
|
12
|
-
gem 'protocol-redis'
|
13
|
-
```
|
11
|
+
- [Getting Started](https://socketry.github.io/protocol-redis/guides/getting-started/index) - This guide explains how to use the `Protocol::Redis` gem to implement the RESP2 and RESP3 Redis protocols for low level client and server implementations.
|
14
12
|
|
15
|
-
|
13
|
+
## Releases
|
16
14
|
|
17
|
-
|
15
|
+
Please see the [project releases](https://socketry.github.io/protocol-redis/releases/index) for all releases.
|
18
16
|
|
19
|
-
|
17
|
+
### v0.11.0
|
20
18
|
|
21
|
-
|
19
|
+
- Introduce cluster methods, including `Strings`, `Streams`, `Scripting` and `Pubsub`.
|
22
20
|
|
23
|
-
|
21
|
+
### v0.10.0
|
22
|
+
|
23
|
+
- Add agent context.
|
24
|
+
- 100% documentation and test coverage + minor bug fixes.
|
25
|
+
|
26
|
+
### v0.9.0
|
27
|
+
|
28
|
+
- Add support for `client info` command.
|
29
|
+
|
30
|
+
### v0.8.1
|
31
|
+
|
32
|
+
- Fix HSCAN method implementation.
|
33
|
+
|
34
|
+
### v0.8.0
|
35
|
+
|
36
|
+
- Add missing `hscan` method.
|
37
|
+
- Add `mapped_hmget` and `mapped_hmset` methods to match `redis-rb` gem interface.
|
38
|
+
- Add cluster methods to client.
|
39
|
+
- Make hashes methods compatible with redis-rb.
|
40
|
+
|
41
|
+
### v0.7.0
|
42
|
+
|
43
|
+
- Add scripting methods to client and fix script interface.
|
44
|
+
- Include sets and streams in the protocol methods.
|
45
|
+
- Add support for essential `exists?` method.
|
46
|
+
- Prefer bake-gem for release management.
|
47
|
+
|
48
|
+
### v0.6.1
|
49
|
+
|
50
|
+
- Add support for multi-argument auth.
|
24
51
|
|
25
|
-
|
26
|
-
sockets = Socket.pair(Socket::PF_UNIX, Socket::SOCK_STREAM)
|
52
|
+
### v0.6.0
|
27
53
|
|
28
|
-
|
29
|
-
server = Protocol::Redis::Connection.new(sockets.last)
|
54
|
+
- Add relevant pubsub method group.
|
30
55
|
|
31
|
-
|
32
|
-
puts server.read_object
|
33
|
-
# => "Hello World!"
|
34
|
-
```
|
56
|
+
### v0.5.1
|
35
57
|
|
36
|
-
|
58
|
+
- Add tests for info command, streams, and string methods.
|
59
|
+
- Use correct CRLF constant in server methods.
|
60
|
+
- Modernize gem configuration.
|
37
61
|
|
38
|
-
|
62
|
+
### v0.5.0
|
39
63
|
|
40
|
-
|
64
|
+
- Add incomplete implementations of scripting, sets and streams.
|
65
|
+
- Merge existing sorted set implementations.
|
66
|
+
- Add `zrangebyscore` method.
|
67
|
+
- Improve argument management.
|
68
|
+
- Modernize testing infrastructure.
|
41
69
|
|
42
70
|
## Contributing
|
43
71
|
|