redis 3.0.0 → 4.5.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.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +315 -0
  3. data/README.md +301 -58
  4. data/lib/redis/client.rb +383 -88
  5. data/lib/redis/cluster/command.rb +81 -0
  6. data/lib/redis/cluster/command_loader.rb +33 -0
  7. data/lib/redis/cluster/key_slot_converter.rb +72 -0
  8. data/lib/redis/cluster/node.rb +108 -0
  9. data/lib/redis/cluster/node_key.rb +31 -0
  10. data/lib/redis/cluster/node_loader.rb +37 -0
  11. data/lib/redis/cluster/option.rb +93 -0
  12. data/lib/redis/cluster/slot.rb +86 -0
  13. data/lib/redis/cluster/slot_loader.rb +49 -0
  14. data/lib/redis/cluster.rb +291 -0
  15. data/lib/redis/connection/command_helper.rb +7 -10
  16. data/lib/redis/connection/hiredis.rb +12 -8
  17. data/lib/redis/connection/registry.rb +2 -1
  18. data/lib/redis/connection/ruby.rb +266 -74
  19. data/lib/redis/connection/synchrony.rb +41 -14
  20. data/lib/redis/connection.rb +4 -2
  21. data/lib/redis/distributed.rb +258 -76
  22. data/lib/redis/errors.rb +48 -0
  23. data/lib/redis/hash_ring.rb +31 -73
  24. data/lib/redis/pipeline.rb +74 -18
  25. data/lib/redis/subscribe.rb +24 -13
  26. data/lib/redis/version.rb +3 -1
  27. data/lib/redis.rb +2068 -464
  28. metadata +63 -160
  29. data/.gitignore +0 -10
  30. data/.order +0 -169
  31. data/.travis/Gemfile +0 -11
  32. data/.travis.yml +0 -50
  33. data/.yardopts +0 -3
  34. data/Rakefile +0 -392
  35. data/benchmarking/logging.rb +0 -62
  36. data/benchmarking/pipeline.rb +0 -51
  37. data/benchmarking/speed.rb +0 -21
  38. data/benchmarking/suite.rb +0 -24
  39. data/benchmarking/worker.rb +0 -71
  40. data/examples/basic.rb +0 -15
  41. data/examples/dist_redis.rb +0 -43
  42. data/examples/incr-decr.rb +0 -17
  43. data/examples/list.rb +0 -26
  44. data/examples/pubsub.rb +0 -31
  45. data/examples/sets.rb +0 -36
  46. data/examples/unicorn/config.ru +0 -3
  47. data/examples/unicorn/unicorn.rb +0 -20
  48. data/redis.gemspec +0 -41
  49. data/test/blocking_commands_test.rb +0 -42
  50. data/test/command_map_test.rb +0 -30
  51. data/test/commands_on_hashes_test.rb +0 -21
  52. data/test/commands_on_lists_test.rb +0 -20
  53. data/test/commands_on_sets_test.rb +0 -77
  54. data/test/commands_on_sorted_sets_test.rb +0 -109
  55. data/test/commands_on_strings_test.rb +0 -83
  56. data/test/commands_on_value_types_test.rb +0 -99
  57. data/test/connection_handling_test.rb +0 -189
  58. data/test/db/.gitignore +0 -1
  59. data/test/distributed_blocking_commands_test.rb +0 -46
  60. data/test/distributed_commands_on_hashes_test.rb +0 -10
  61. data/test/distributed_commands_on_lists_test.rb +0 -22
  62. data/test/distributed_commands_on_sets_test.rb +0 -83
  63. data/test/distributed_commands_on_sorted_sets_test.rb +0 -18
  64. data/test/distributed_commands_on_strings_test.rb +0 -48
  65. data/test/distributed_commands_on_value_types_test.rb +0 -87
  66. data/test/distributed_commands_requiring_clustering_test.rb +0 -148
  67. data/test/distributed_connection_handling_test.rb +0 -23
  68. data/test/distributed_internals_test.rb +0 -15
  69. data/test/distributed_key_tags_test.rb +0 -52
  70. data/test/distributed_persistence_control_commands_test.rb +0 -26
  71. data/test/distributed_publish_subscribe_test.rb +0 -92
  72. data/test/distributed_remote_server_control_commands_test.rb +0 -53
  73. data/test/distributed_scripting_test.rb +0 -102
  74. data/test/distributed_sorting_test.rb +0 -20
  75. data/test/distributed_test.rb +0 -58
  76. data/test/distributed_transactions_test.rb +0 -32
  77. data/test/encoding_test.rb +0 -18
  78. data/test/error_replies_test.rb +0 -59
  79. data/test/helper.rb +0 -188
  80. data/test/helper_test.rb +0 -22
  81. data/test/internals_test.rb +0 -214
  82. data/test/lint/blocking_commands.rb +0 -124
  83. data/test/lint/hashes.rb +0 -162
  84. data/test/lint/lists.rb +0 -143
  85. data/test/lint/sets.rb +0 -96
  86. data/test/lint/sorted_sets.rb +0 -201
  87. data/test/lint/strings.rb +0 -157
  88. data/test/lint/value_types.rb +0 -106
  89. data/test/persistence_control_commands_test.rb +0 -26
  90. data/test/pipelining_commands_test.rb +0 -195
  91. data/test/publish_subscribe_test.rb +0 -153
  92. data/test/remote_server_control_commands_test.rb +0 -104
  93. data/test/scripting_test.rb +0 -78
  94. data/test/sorting_test.rb +0 -45
  95. data/test/support/connection/hiredis.rb +0 -1
  96. data/test/support/connection/ruby.rb +0 -1
  97. data/test/support/connection/synchrony.rb +0 -17
  98. data/test/support/redis_mock.rb +0 -92
  99. data/test/support/wire/synchrony.rb +0 -24
  100. data/test/support/wire/thread.rb +0 -5
  101. data/test/synchrony_driver.rb +0 -57
  102. data/test/test.conf +0 -9
  103. data/test/thread_safety_test.rb +0 -32
  104. data/test/transactions_test.rb +0 -244
  105. data/test/unknown_commands_test.rb +0 -14
  106. data/test/url_param_test.rb +0 -64
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b1e483240f70aa8a92a7fe1f38968262ea82e84a97e436a9c7c695c032584313
4
+ data.tar.gz: 1cb164b2d588ef2f2701b91371a12a0d90299a78994f0d614cb14ab0daa36243
5
+ SHA512:
6
+ metadata.gz: 72c3e91839061ae26e27cbb08330f752acbba5f440c8549cad4325b2c2f517a907a0db11330ca9ba221255aa7b570efe2050bde9cbb905217794c4754c53dadb
7
+ data.tar.gz: e92cc58111fb9e1553a3363c56569ef6064c3851263d5eb86147c907878650b697db5c598b2b2046f9c9025cc40ca7eda5ce16f4f21049ac49f09385cf80a92f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,318 @@
1
+ # Unreleased
2
+
3
+ # 4.5.0
4
+
5
+ * Handle parts of the command using incompatible encodings. See #1037.
6
+ * Add GET option to SET command. See #1036.
7
+ * Add ZRANDMEMBER command. See #1035.
8
+ * Add LMOVE/BLMOVE commands. See #1034.
9
+ * Add ZMSCORE command. See #1032.
10
+ * Add LT/GT options to ZADD. See #1033.
11
+ * Add SMISMEMBER command. See #1031.
12
+ * Add EXAT/PXAT options to SET. See #1028.
13
+ * Add GETDEL/GETEX commands. See #1024.
14
+ * `Redis#exists` now returns an Integer by default, as warned since 4.2.0. The old behavior can be restored with `Redis.exists_returns_integer = false`.
15
+ * Fix Redis < 6 detection during connect. See #1025.
16
+ * Fix fetching command details in Redis cluster when the first node is unhealthy. See #1026.
17
+
18
+ # 4.4.0
19
+
20
+ * Redis cluster: fix cross-slot validation in pipelines. Fix ##1019.
21
+ * Add support for `XAUTOCLAIM`. See #1018.
22
+ * Properly issue `READONLY` when reconnecting to replicas. Fix #1017.
23
+ * Make `del` a noop if passed an empty list of keys. See #998.
24
+ * Add support for `ZINTER`. See #995.
25
+
26
+ # 4.3.1
27
+
28
+ * Fix password authentication against redis server 5 and older.
29
+
30
+ # 4.3.0
31
+
32
+ * Add the TYPE argument to scan and scan_each. See #985.
33
+ * Support AUTH command for ACL. See #967.
34
+
35
+ # 4.2.5
36
+
37
+ * Optimize the ruby connector write buffering. See #964.
38
+
39
+ # 4.2.4
40
+
41
+ * Fix bytesize calculations in the ruby connector, and work on a copy of the buffer. Fix #961, #962.
42
+
43
+ # 4.2.3
44
+
45
+ * Use io/wait instead of IO.select in the ruby connector. See #960.
46
+ * Use exception free non blocking IOs in the ruby connector. See #926.
47
+ * Prevent corruption of the client when an interrupt happen during inside a pipeline block. See #945.
48
+
49
+ # 4.2.2
50
+
51
+ * Fix `WATCH` support for `Redis::Distributed`. See #941.
52
+ * Fix handling of empty stream responses. See #905, #929.
53
+
54
+ # 4.2.1
55
+
56
+ * Fix `exists?` returning an actual boolean when called with multiple keys. See #918.
57
+ * Setting `Redis.exists_returns_integer = false` disables warning message about new behaviour. See #920.
58
+
59
+ # 4.2.0
60
+
61
+ * Convert commands to accept keyword arguments rather than option hashes. This both help catching typos, and reduce needless allocations.
62
+ * Deprecate the synchrony driver. It will be removed in 5.0 and hopefully maintained as a separate gem. See #915.
63
+ * Make `Redis#exists` variadic, will return an Integer if called with multiple keys.
64
+ * Add `Redis#exists?` to get a Boolean if any of the keys exists.
65
+ * `Redis#exists` when called with a single key will warn that future versions will return an Integer.
66
+ Set `Redis.exists_returns_integer = true` to opt-in to the new behavior.
67
+ * Support `keepttl` ooption in `set`. See #913.
68
+ * Optimized initialization of Redis::Cluster. See #912.
69
+ * Accept sentinel options even with string key. See #599.
70
+ * Verify TLS connections by default. See #900.
71
+ * Make `Redis#hset` variadic. It now returns an integer, not a boolean. See #910.
72
+
73
+ # 4.1.4
74
+
75
+ * Alias `Redis#disconnect` as `#close`. See #901.
76
+ * Handle clusters with multiple slot ranges. See #894.
77
+ * Fix password authentication to a redis cluster. See #889.
78
+ * Handle recursive MOVED responses. See #882.
79
+ * Increase buffer size in the ruby connector. See #880.
80
+ * Fix thread safety of `Redis.queue`. See #878.
81
+ * Deprecate `Redis::Future#==` as it's likely to be a mistake. See #876.
82
+ * Support `KEEPTTL` option for SET command. See #913.
83
+
84
+ # 4.1.3
85
+
86
+ * Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
87
+
88
+ # 4.1.2
89
+
90
+ * Fix several authentication problems with sentinel. See #850 and #856.
91
+ * Explicitly drop Ruby 2.2 support.
92
+
93
+
94
+ # 4.1.1
95
+
96
+ * Fix error handling in multi blocks. See #754.
97
+ * Fix geoadd to accept arrays like georadius and georadiusbymember. See #841.
98
+ * Fix georadius command failing when long == lat. See #841.
99
+ * Fix timeout error in xread block: 0. See #837.
100
+ * Fix incompatibility issue with redis-objects. See #834.
101
+ * Properly handle Errno::EADDRNOTAVAIL on connect.
102
+ * Fix password authentication to sentinel instances. See #813.
103
+
104
+ # 4.1.0
105
+
106
+ * Add Redis Cluster support. See #716.
107
+ * Add streams support. See #799 and #811.
108
+ * Add ZPOP* support. See #812.
109
+ * Fix issues with integer-like objects as BPOP timeout
110
+
111
+ # 4.0.3
112
+
113
+ * Fix raising command error for first command in pipeline. See #788.
114
+ * Fix the gemspec to stop exposing a `build` executable. See #785.
115
+ * Add `:reconnect_delay` and `:reconnect_delay_max` options. See #778.
116
+
117
+ # 4.0.2
118
+
119
+ * Added `Redis#unlink`. See #766.
120
+
121
+ * `Redis.new` now accept a custom connector via `:connector`. See #591.
122
+
123
+ * `Redis#multi` no longer perform empty transactions. See #747.
124
+
125
+ * `Redis#hdel` now accepts hash keys as multiple arguments like `#del`. See #755.
126
+
127
+ * Allow to skip SSL verification. See #745.
128
+
129
+ * Add Geo commands: `geoadd`, `geohash`, `georadius`, `georadiusbymember`, `geopos`, `geodist`. See #730.
130
+
131
+ # 4.0.1
132
+
133
+ * `Redis::Distributed` now supports `mget` and `mapped_mget`. See #687.
134
+
135
+ * `Redis::Distributed` now supports `sscan` and `sscan_each`. See #572.
136
+
137
+ * `Redis#connection` returns a hash with connection information.
138
+ You shouldn't need to call `Redis#_client`, ever.
139
+
140
+ * `Redis#flushdb` and `Redis#flushall` now support the `:async` option. See #706.
141
+
142
+
143
+ # 4.0
144
+
145
+ * Removed `Redis.connect`. Use `Redis.new`.
146
+
147
+ * Removed `Redis#[]` and `Redis#[]=` aliases.
148
+
149
+ * Added support for `CLIENT` commands. The lower-level client can be
150
+ accessed via `Redis#_client`.
151
+
152
+ * Dropped official support for Ruby < 2.2.2.
153
+
154
+ # 3.3.5
155
+
156
+ * Fixed Ruby 1.8 compatibility after backporting `Redis#connection`. See #719.
157
+
158
+ # 3.3.4 (yanked)
159
+
160
+ * `Redis#connection` returns a hash with connection information.
161
+ You shouldn't need to call `Redis#_client`, ever.
162
+
163
+ # 3.3.3
164
+
165
+ * Improved timeout handling after dropping Timeout module.
166
+
167
+ # 3.3.2
168
+
169
+ * Added support for `SPOP` with COUNT. See #628.
170
+
171
+ * Fixed connection glitches when using SSL. See #644.
172
+
173
+ # 3.3.1
174
+
175
+ * Remove usage of Timeout::timeout, refactor into using low level non-blocking writes.
176
+ This fixes a memory leak due to Timeout creating threads on each invocation.
177
+
178
+ # 3.3.0
179
+
180
+ * Added support for SSL/TLS. Redis doesn't support SSL natively, so you still
181
+ need to run a terminating proxy on Redis' side. See #496.
182
+
183
+ * Added `read_timeout` and `write_timeout` options. See #437, #482.
184
+
185
+ * Added support for pub/sub with timeouts. See #329.
186
+
187
+ * Added `Redis#call`, `Redis#queue` and `Redis#commit` as a more minimal API to
188
+ the client.
189
+
190
+ * Deprecated `Redis#disconnect!` in favor of `Redis#close`.
191
+
192
+ # 3.2.2
193
+
194
+ * Added support for `ZADD` options `NX`, `XX`, `CH`, `INCR`. See #547.
195
+
196
+ * Added support for sentinel commands. See #556.
197
+
198
+ * New `:id` option allows you to identify the client against Redis. See #510.
199
+
200
+ * `Redis::Distributed` will raise when adding two nodes with the same ID.
201
+ See #354.
202
+
203
+ # 3.2.1
204
+
205
+ * Added support for `PUBSUB` command.
206
+
207
+ * More low-level socket errors are now raised as `CannotConnectError`.
208
+
209
+ * Added `:connect_timeout` option.
210
+
211
+ * Added support for `:limit` option for `ZREVRANGEBYLEX`.
212
+
213
+ * Fixed an issue where connections become inconsistent when using Ruby's
214
+ Timeout module outside of the client (see #501, #502).
215
+
216
+ * Added `Redis#disconnect!` as a public-API way of disconnecting the client
217
+ (without needing to use `QUIT`). See #506.
218
+
219
+ * Fixed Sentinel support with Hiredis.
220
+
221
+ * Fixed Sentinel support when using authentication and databases.
222
+
223
+ * Improved resilience when trying to contact sentinels.
224
+
225
+ # 3.2.0
226
+
227
+ * Redis Sentinel support.
228
+
229
+ # 3.1.0
230
+
231
+ * Added debug log sanitization (#428).
232
+
233
+ * Added support for HyperLogLog commands (Redis 2.8.9, #432).
234
+
235
+ * Added support for `BITPOS` command (Redis 2.9.11, #412).
236
+
237
+ * The client will now automatically reconnect after a fork (#414).
238
+
239
+ * If you want to disable the fork-safety check and prefer to share the
240
+ connection across child processes, you can now pass the `inherit_socket`
241
+ option (#409).
242
+
243
+ * If you want the client to attempt to reconnect more than once, you can now
244
+ pass the `reconnect_attempts` option (#347)
245
+
246
+ # 3.0.7
247
+
248
+ * Added method `Redis#dup` to duplicate a Redis connection.
249
+
250
+ * IPv6 support.
251
+
252
+ # 3.0.6
253
+
254
+ * Added support for `SCAN` and variants.
255
+
256
+ # 3.0.5
257
+
258
+ * Fix calling #select from a pipeline (#309).
259
+
260
+ * Added method `Redis#connected?`.
261
+
262
+ * Added support for `MIGRATE` (Redis 2.6).
263
+
264
+ * Support extended SET command (#343, thanks to @benubois).
265
+
266
+ # 3.0.4
267
+
268
+ * Ensure #watch without a block returns "OK" (#332).
269
+
270
+ * Make futures identifiable (#330).
271
+
272
+ * Fix an issue preventing STORE in a SORT with multiple GETs (#328).
273
+
274
+ # 3.0.3
275
+
276
+ * Blocking list commands (`BLPOP`, `BRPOP`, `BRPOPLPUSH`) use a socket
277
+ timeout equal to the sum of the command's timeout and the Redis
278
+ client's timeout, instead of disabling socket timeout altogether.
279
+
280
+ * Ruby 2.0 compatibility.
281
+
282
+ * Added support for `DUMP` and `RESTORE` (Redis 2.6).
283
+
284
+ * Added support for `BITCOUNT` and `BITOP` (Redis 2.6).
285
+
286
+ * Call `#to_s` on value argument for `SET`, `SETEX`, `PSETEX`, `GETSET`,
287
+ `SETNX`, and `SETRANGE`.
288
+
289
+ # 3.0.2
290
+
291
+ * Unescape CGI escaped password in URL.
292
+
293
+ * Fix test to check availability of `UNIXSocket`.
294
+
295
+ * Fix handling of score = +/- infinity for sorted set commands.
296
+
297
+ * Replace array splats with concatenation where possible.
298
+
299
+ * Raise if `EXEC` returns an error.
300
+
301
+ * Passing a nil value in options hash no longer overwrites the default.
302
+
303
+ * Allow string keys in options hash passed to `Redis.new` or
304
+ `Redis.connect`.
305
+
306
+ * Fix uncaught error triggering unrelated error (synchrony driver).
307
+
308
+ See f7ffd5f1a628029691084de69e5b46699bb8b96d and #248.
309
+
310
+ # 3.0.1
311
+
312
+ * Fix reconnect logic not kicking in on a write error.
313
+
314
+ See 427dbd52928af452f35aa0a57b621bee56cdcb18 and #238.
315
+
1
316
  # 3.0.0
2
317
 
3
318
  ### Upgrading from 2.x to 3.0