redis 3.2.0 → 4.6.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 (133) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +278 -15
  3. data/README.md +260 -76
  4. data/lib/redis/client.rb +239 -115
  5. data/lib/redis/cluster/command.rb +79 -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 +120 -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 +315 -0
  15. data/lib/redis/commands/bitmaps.rb +63 -0
  16. data/lib/redis/commands/cluster.rb +45 -0
  17. data/lib/redis/commands/connection.rb +58 -0
  18. data/lib/redis/commands/geo.rb +84 -0
  19. data/lib/redis/commands/hashes.rb +251 -0
  20. data/lib/redis/commands/hyper_log_log.rb +37 -0
  21. data/lib/redis/commands/keys.rb +411 -0
  22. data/lib/redis/commands/lists.rb +289 -0
  23. data/lib/redis/commands/pubsub.rb +72 -0
  24. data/lib/redis/commands/scripting.rb +114 -0
  25. data/lib/redis/commands/server.rb +188 -0
  26. data/lib/redis/commands/sets.rb +207 -0
  27. data/lib/redis/commands/sorted_sets.rb +804 -0
  28. data/lib/redis/commands/streams.rb +382 -0
  29. data/lib/redis/commands/strings.rb +313 -0
  30. data/lib/redis/commands/transactions.rb +92 -0
  31. data/lib/redis/commands.rb +242 -0
  32. data/lib/redis/connection/command_helper.rb +7 -10
  33. data/lib/redis/connection/hiredis.rb +11 -6
  34. data/lib/redis/connection/registry.rb +2 -1
  35. data/lib/redis/connection/ruby.rb +173 -64
  36. data/lib/redis/connection/synchrony.rb +32 -8
  37. data/lib/redis/connection.rb +3 -1
  38. data/lib/redis/distributed.rb +233 -74
  39. data/lib/redis/errors.rb +48 -0
  40. data/lib/redis/hash_ring.rb +30 -72
  41. data/lib/redis/pipeline.rb +145 -12
  42. data/lib/redis/subscribe.rb +20 -13
  43. data/lib/redis/version.rb +3 -1
  44. data/lib/redis.rb +171 -2476
  45. metadata +71 -165
  46. data/.gitignore +0 -15
  47. data/.travis/Gemfile +0 -11
  48. data/.travis.yml +0 -54
  49. data/.yardopts +0 -3
  50. data/Gemfile +0 -4
  51. data/Rakefile +0 -68
  52. data/benchmarking/logging.rb +0 -71
  53. data/benchmarking/pipeline.rb +0 -51
  54. data/benchmarking/speed.rb +0 -21
  55. data/benchmarking/suite.rb +0 -24
  56. data/benchmarking/worker.rb +0 -71
  57. data/examples/basic.rb +0 -15
  58. data/examples/consistency.rb +0 -114
  59. data/examples/dist_redis.rb +0 -43
  60. data/examples/incr-decr.rb +0 -17
  61. data/examples/list.rb +0 -26
  62. data/examples/pubsub.rb +0 -37
  63. data/examples/sentinel/sentinel.conf +0 -9
  64. data/examples/sentinel/start +0 -49
  65. data/examples/sentinel.rb +0 -41
  66. data/examples/sets.rb +0 -36
  67. data/examples/unicorn/config.ru +0 -3
  68. data/examples/unicorn/unicorn.rb +0 -20
  69. data/redis.gemspec +0 -43
  70. data/test/bitpos_test.rb +0 -69
  71. data/test/blocking_commands_test.rb +0 -42
  72. data/test/command_map_test.rb +0 -30
  73. data/test/commands_on_hashes_test.rb +0 -21
  74. data/test/commands_on_hyper_log_log_test.rb +0 -21
  75. data/test/commands_on_lists_test.rb +0 -20
  76. data/test/commands_on_sets_test.rb +0 -77
  77. data/test/commands_on_sorted_sets_test.rb +0 -123
  78. data/test/commands_on_strings_test.rb +0 -101
  79. data/test/commands_on_value_types_test.rb +0 -131
  80. data/test/connection_handling_test.rb +0 -189
  81. data/test/db/.gitkeep +0 -0
  82. data/test/distributed_blocking_commands_test.rb +0 -46
  83. data/test/distributed_commands_on_hashes_test.rb +0 -10
  84. data/test/distributed_commands_on_hyper_log_log_test.rb +0 -33
  85. data/test/distributed_commands_on_lists_test.rb +0 -22
  86. data/test/distributed_commands_on_sets_test.rb +0 -83
  87. data/test/distributed_commands_on_sorted_sets_test.rb +0 -18
  88. data/test/distributed_commands_on_strings_test.rb +0 -59
  89. data/test/distributed_commands_on_value_types_test.rb +0 -95
  90. data/test/distributed_commands_requiring_clustering_test.rb +0 -164
  91. data/test/distributed_connection_handling_test.rb +0 -23
  92. data/test/distributed_internals_test.rb +0 -70
  93. data/test/distributed_key_tags_test.rb +0 -52
  94. data/test/distributed_persistence_control_commands_test.rb +0 -26
  95. data/test/distributed_publish_subscribe_test.rb +0 -92
  96. data/test/distributed_remote_server_control_commands_test.rb +0 -66
  97. data/test/distributed_scripting_test.rb +0 -102
  98. data/test/distributed_sorting_test.rb +0 -20
  99. data/test/distributed_test.rb +0 -58
  100. data/test/distributed_transactions_test.rb +0 -32
  101. data/test/encoding_test.rb +0 -18
  102. data/test/error_replies_test.rb +0 -59
  103. data/test/fork_safety_test.rb +0 -65
  104. data/test/helper.rb +0 -232
  105. data/test/helper_test.rb +0 -24
  106. data/test/internals_test.rb +0 -434
  107. data/test/lint/blocking_commands.rb +0 -150
  108. data/test/lint/hashes.rb +0 -162
  109. data/test/lint/hyper_log_log.rb +0 -60
  110. data/test/lint/lists.rb +0 -143
  111. data/test/lint/sets.rb +0 -125
  112. data/test/lint/sorted_sets.rb +0 -238
  113. data/test/lint/strings.rb +0 -260
  114. data/test/lint/value_types.rb +0 -122
  115. data/test/persistence_control_commands_test.rb +0 -26
  116. data/test/pipelining_commands_test.rb +0 -242
  117. data/test/publish_subscribe_test.rb +0 -210
  118. data/test/remote_server_control_commands_test.rb +0 -117
  119. data/test/scanning_test.rb +0 -413
  120. data/test/scripting_test.rb +0 -78
  121. data/test/sorting_test.rb +0 -59
  122. data/test/support/connection/hiredis.rb +0 -1
  123. data/test/support/connection/ruby.rb +0 -1
  124. data/test/support/connection/synchrony.rb +0 -17
  125. data/test/support/redis_mock.rb +0 -115
  126. data/test/support/wire/synchrony.rb +0 -24
  127. data/test/support/wire/thread.rb +0 -5
  128. data/test/synchrony_driver.rb +0 -88
  129. data/test/test.conf +0 -9
  130. data/test/thread_safety_test.rb +0 -32
  131. data/test/transactions_test.rb +0 -264
  132. data/test/unknown_commands_test.rb +0 -14
  133. data/test/url_param_test.rb +0 -132
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e25c90cb532eea0215afe63b0156fa102446c5f2
4
- data.tar.gz: b2acddebb3e293807a9b6bb6a6f986432859afb0
2
+ SHA256:
3
+ metadata.gz: 7e99f4e628112a227719d2000dc5b081893273cfbd51ae25bf00a8f6b6594061
4
+ data.tar.gz: 42a8e0cf75aebbc14cdf680b4bc1f7bbdec9e20b53f150c6443c01126960a959
5
5
  SHA512:
6
- metadata.gz: f599db91c12cf1a0e6a86c114e6ea687f9027d1a58e982f4f68bded6e38409cf4aab46fb742ec2d9fd80e85214a41a7f341399348645bb8765099c8f059b3efe
7
- data.tar.gz: 12fb14500e54c7eeb46a79a9b112eb5b85a457c50ae388f505db18b9a2ab826d3c206bd4d5bc778b487a94f7af48d8b5df79f1f01396087c2b856ea2e0b589d8
6
+ metadata.gz: 8bc57fe306c601f27d32df4940d5632e9e7d75529f6ac5d42732b21fe04452a4a1ab89567492c6fb7249ef4d69ebb2c0b7c985e18b0ef4f9ee6fb816c31bcbda
7
+ data.tar.gz: 42b2f8c584d6f96d0fc783d0b36af0fd9415d1dbd43ad8fe7a980688e52fbdb51645a07960d9cb3faacf6696c460cf38a013e290d0b58d4bbbb07626f18f15c7
data/CHANGELOG.md CHANGED
@@ -1,24 +1,287 @@
1
- # 4.x (unreleased)
1
+ # Unreleased
2
+
3
+ # 4.6.0
4
+
5
+ * Deprecate `Redis.current`.
6
+ * Deprecate calling commands on `Redis` inside `Redis#pipelined`. See #1059.
7
+ ```ruby
8
+ redis.pipelined do
9
+ redis.get("key")
10
+ end
11
+ ```
2
12
 
3
- ## Planned breaking changes:
4
- * `Redis#client` will no longer expose the underlying `Redis::Client`;
5
- it has not yet been determined how 4.0 will expose the underlying
6
- functionality, but we will make every attempt to provide a final minor
7
- release of 3.x that provides the new interfaces in order to facilitate
8
- a smooth transition.
13
+ should be replaced by:
9
14
 
10
- * Ruby 1.8.7 (and the 1.8 modes of JRuby and Rubinius) will no longer be
11
- supported; 1.8.x entered end-of-life in June of 2012 and stopped receiving
12
- security updates in June of 2013; continuing to support it would prevent
13
- the use of newer features of Ruby.
15
+ ```ruby
16
+ redis.pipelined do |pipeline|
17
+ pipeline.get("key")
18
+ end
19
+ ```
20
+ * Deprecate calling commands on `Redis` inside `Redis#multi`. See #1059.
21
+ ```ruby
22
+ redis.multi do
23
+ redis.get("key")
24
+ end
25
+ ```
26
+
27
+ should be replaced by:
28
+
29
+ ```ruby
30
+ redis.multi do |transaction|
31
+ transaction.get("key")
32
+ end
33
+ ```
34
+ * Deprecate `Redis#queue` and `Redis#commit`. See #1059.
35
+
36
+ * Fix `zpopmax` and `zpopmin` when called inside a pipeline. See #1055.
37
+ * `Redis#synchronize` is now private like it should always have been.
38
+
39
+ * Add `Redis.silence_deprecations=` to turn off deprecation warnings.
40
+ If you don't wish to see warnings yet, you can set `Redis.silence_deprecations = false`.
41
+ It is however heavily recommended to fix them instead when possible.
42
+ * Add `Redis.raise_deprecations=` to turn deprecation warnings into errors.
43
+ This makes it easier to identitify the source of deprecated APIs usage.
44
+ It is recommended to set `Redis.raise_deprecations = true` in development and test environments.
45
+ * Add new options to ZRANGE. See #1053.
46
+ * Add ZRANGESTORE command. See #1053.
47
+ * Add SCAN support for `Redis::Cluster`. See #1049.
48
+ * Add COPY command. See #1053. See #1048.
49
+ * Add ZDIFFSTORE command. See #1046.
50
+ * Add ZDIFF command. See #1044.
51
+ * Add ZUNION command. See #1042.
52
+ * Add HRANDFIELD command. See #1040.
14
53
 
15
- # 3.2.0
54
+ # 4.5.1
16
55
 
17
- * Redis Sentinel support.
56
+ * Restore the accidential auth behavior of redis-rb 4.3.0 with a warning. If provided with the `default` user's password, but a wrong username,
57
+ redis-rb will first try to connect as the provided user, but then will fallback to connect as the `default` user with the provided password.
58
+ This behavior is deprecated and will be removed in Redis 4.6.0. Fix #1038.
59
+
60
+ # 4.5.0
61
+
62
+ * Handle parts of the command using incompatible encodings. See #1037.
63
+ * Add GET option to SET command. See #1036.
64
+ * Add ZRANDMEMBER command. See #1035.
65
+ * Add LMOVE/BLMOVE commands. See #1034.
66
+ * Add ZMSCORE command. See #1032.
67
+ * Add LT/GT options to ZADD. See #1033.
68
+ * Add SMISMEMBER command. See #1031.
69
+ * Add EXAT/PXAT options to SET. See #1028.
70
+ * Add GETDEL/GETEX commands. See #1024.
71
+ * `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`.
72
+ * Fix Redis < 6 detection during connect. See #1025.
73
+ * Fix fetching command details in Redis cluster when the first node is unhealthy. See #1026.
74
+
75
+ # 4.4.0
76
+
77
+ * Redis cluster: fix cross-slot validation in pipelines. Fix ##1019.
78
+ * Add support for `XAUTOCLAIM`. See #1018.
79
+ * Properly issue `READONLY` when reconnecting to replicas. Fix #1017.
80
+ * Make `del` a noop if passed an empty list of keys. See #998.
81
+ * Add support for `ZINTER`. See #995.
82
+
83
+ # 4.3.1
84
+
85
+ * Fix password authentication against redis server 5 and older.
86
+
87
+ # 4.3.0
88
+
89
+ * Add the TYPE argument to scan and scan_each. See #985.
90
+ * Support AUTH command for ACL. See #967.
91
+
92
+ # 4.2.5
93
+
94
+ * Optimize the ruby connector write buffering. See #964.
95
+
96
+ # 4.2.4
97
+
98
+ * Fix bytesize calculations in the ruby connector, and work on a copy of the buffer. Fix #961, #962.
99
+
100
+ # 4.2.3
101
+
102
+ * Use io/wait instead of IO.select in the ruby connector. See #960.
103
+ * Use exception free non blocking IOs in the ruby connector. See #926.
104
+ * Prevent corruption of the client when an interrupt happen during inside a pipeline block. See #945.
105
+
106
+ # 4.2.2
107
+
108
+ * Fix `WATCH` support for `Redis::Distributed`. See #941.
109
+ * Fix handling of empty stream responses. See #905, #929.
110
+
111
+ # 4.2.1
112
+
113
+ * Fix `exists?` returning an actual boolean when called with multiple keys. See #918.
114
+ * Setting `Redis.exists_returns_integer = false` disables warning message about new behaviour. See #920.
115
+
116
+ # 4.2.0
117
+
118
+ * Convert commands to accept keyword arguments rather than option hashes. This both help catching typos, and reduce needless allocations.
119
+ * Deprecate the synchrony driver. It will be removed in 5.0 and hopefully maintained as a separate gem. See #915.
120
+ * Make `Redis#exists` variadic, will return an Integer if called with multiple keys.
121
+ * Add `Redis#exists?` to get a Boolean if any of the keys exists.
122
+ * `Redis#exists` when called with a single key will warn that future versions will return an Integer.
123
+ Set `Redis.exists_returns_integer = true` to opt-in to the new behavior.
124
+ * Support `keepttl` ooption in `set`. See #913.
125
+ * Optimized initialization of Redis::Cluster. See #912.
126
+ * Accept sentinel options even with string key. See #599.
127
+ * Verify TLS connections by default. See #900.
128
+ * Make `Redis#hset` variadic. It now returns an integer, not a boolean. See #910.
129
+
130
+ # 4.1.4
131
+
132
+ * Alias `Redis#disconnect` as `#close`. See #901.
133
+ * Handle clusters with multiple slot ranges. See #894.
134
+ * Fix password authentication to a redis cluster. See #889.
135
+ * Handle recursive MOVED responses. See #882.
136
+ * Increase buffer size in the ruby connector. See #880.
137
+ * Fix thread safety of `Redis.queue`. See #878.
138
+ * Deprecate `Redis::Future#==` as it's likely to be a mistake. See #876.
139
+ * Support `KEEPTTL` option for SET command. See #913.
140
+
141
+ # 4.1.3
142
+
143
+ * Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
144
+
145
+ # 4.1.2
146
+
147
+ * Fix several authentication problems with sentinel. See #850 and #856.
148
+ * Explicitly drop Ruby 2.2 support.
149
+
150
+
151
+ # 4.1.1
152
+
153
+ * Fix error handling in multi blocks. See #754.
154
+ * Fix geoadd to accept arrays like georadius and georadiusbymember. See #841.
155
+ * Fix georadius command failing when long == lat. See #841.
156
+ * Fix timeout error in xread block: 0. See #837.
157
+ * Fix incompatibility issue with redis-objects. See #834.
158
+ * Properly handle Errno::EADDRNOTAVAIL on connect.
159
+ * Fix password authentication to sentinel instances. See #813.
160
+
161
+ # 4.1.0
162
+
163
+ * Add Redis Cluster support. See #716.
164
+ * Add streams support. See #799 and #811.
165
+ * Add ZPOP* support. See #812.
166
+ * Fix issues with integer-like objects as BPOP timeout
167
+
168
+ # 4.0.3
169
+
170
+ * Fix raising command error for first command in pipeline. See #788.
171
+ * Fix the gemspec to stop exposing a `build` executable. See #785.
172
+ * Add `:reconnect_delay` and `:reconnect_delay_max` options. See #778.
173
+
174
+ # 4.0.2
175
+
176
+ * Added `Redis#unlink`. See #766.
177
+
178
+ * `Redis.new` now accept a custom connector via `:connector`. See #591.
179
+
180
+ * `Redis#multi` no longer perform empty transactions. See #747.
181
+
182
+ * `Redis#hdel` now accepts hash keys as multiple arguments like `#del`. See #755.
183
+
184
+ * Allow to skip SSL verification. See #745.
185
+
186
+ * Add Geo commands: `geoadd`, `geohash`, `georadius`, `georadiusbymember`, `geopos`, `geodist`. See #730.
187
+
188
+ # 4.0.1
189
+
190
+ * `Redis::Distributed` now supports `mget` and `mapped_mget`. See #687.
18
191
 
19
- # 3.1.1 (unreleased)
192
+ * `Redis::Distributed` now supports `sscan` and `sscan_each`. See #572.
20
193
 
21
- * Added support for variadic `PFCOUNT`.
194
+ * `Redis#connection` returns a hash with connection information.
195
+ You shouldn't need to call `Redis#_client`, ever.
196
+
197
+ * `Redis#flushdb` and `Redis#flushall` now support the `:async` option. See #706.
198
+
199
+
200
+ # 4.0
201
+
202
+ * Removed `Redis.connect`. Use `Redis.new`.
203
+
204
+ * Removed `Redis#[]` and `Redis#[]=` aliases.
205
+
206
+ * Added support for `CLIENT` commands. The lower-level client can be
207
+ accessed via `Redis#_client`.
208
+
209
+ * Dropped official support for Ruby < 2.2.2.
210
+
211
+ # 3.3.5
212
+
213
+ * Fixed Ruby 1.8 compatibility after backporting `Redis#connection`. See #719.
214
+
215
+ # 3.3.4 (yanked)
216
+
217
+ * `Redis#connection` returns a hash with connection information.
218
+ You shouldn't need to call `Redis#_client`, ever.
219
+
220
+ # 3.3.3
221
+
222
+ * Improved timeout handling after dropping Timeout module.
223
+
224
+ # 3.3.2
225
+
226
+ * Added support for `SPOP` with COUNT. See #628.
227
+
228
+ * Fixed connection glitches when using SSL. See #644.
229
+
230
+ # 3.3.1
231
+
232
+ * Remove usage of Timeout::timeout, refactor into using low level non-blocking writes.
233
+ This fixes a memory leak due to Timeout creating threads on each invocation.
234
+
235
+ # 3.3.0
236
+
237
+ * Added support for SSL/TLS. Redis doesn't support SSL natively, so you still
238
+ need to run a terminating proxy on Redis' side. See #496.
239
+
240
+ * Added `read_timeout` and `write_timeout` options. See #437, #482.
241
+
242
+ * Added support for pub/sub with timeouts. See #329.
243
+
244
+ * Added `Redis#call`, `Redis#queue` and `Redis#commit` as a more minimal API to
245
+ the client.
246
+
247
+ * Deprecated `Redis#disconnect!` in favor of `Redis#close`.
248
+
249
+ # 3.2.2
250
+
251
+ * Added support for `ZADD` options `NX`, `XX`, `CH`, `INCR`. See #547.
252
+
253
+ * Added support for sentinel commands. See #556.
254
+
255
+ * New `:id` option allows you to identify the client against Redis. See #510.
256
+
257
+ * `Redis::Distributed` will raise when adding two nodes with the same ID.
258
+ See #354.
259
+
260
+ # 3.2.1
261
+
262
+ * Added support for `PUBSUB` command.
263
+
264
+ * More low-level socket errors are now raised as `CannotConnectError`.
265
+
266
+ * Added `:connect_timeout` option.
267
+
268
+ * Added support for `:limit` option for `ZREVRANGEBYLEX`.
269
+
270
+ * Fixed an issue where connections become inconsistent when using Ruby's
271
+ Timeout module outside of the client (see #501, #502).
272
+
273
+ * Added `Redis#disconnect!` as a public-API way of disconnecting the client
274
+ (without needing to use `QUIT`). See #506.
275
+
276
+ * Fixed Sentinel support with Hiredis.
277
+
278
+ * Fixed Sentinel support when using authentication and databases.
279
+
280
+ * Improved resilience when trying to contact sentinels.
281
+
282
+ # 3.2.0
283
+
284
+ * Redis Sentinel support.
22
285
 
23
286
  # 3.1.0
24
287