redis 3.3.5 → 5.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +290 -2
  3. data/README.md +146 -146
  4. data/lib/redis/client.rb +79 -541
  5. data/lib/redis/commands/bitmaps.rb +66 -0
  6. data/lib/redis/commands/cluster.rb +28 -0
  7. data/lib/redis/commands/connection.rb +53 -0
  8. data/lib/redis/commands/geo.rb +84 -0
  9. data/lib/redis/commands/hashes.rb +254 -0
  10. data/lib/redis/commands/hyper_log_log.rb +37 -0
  11. data/lib/redis/commands/keys.rb +437 -0
  12. data/lib/redis/commands/lists.rb +339 -0
  13. data/lib/redis/commands/pubsub.rb +54 -0
  14. data/lib/redis/commands/scripting.rb +114 -0
  15. data/lib/redis/commands/server.rb +188 -0
  16. data/lib/redis/commands/sets.rb +214 -0
  17. data/lib/redis/commands/sorted_sets.rb +884 -0
  18. data/lib/redis/commands/streams.rb +402 -0
  19. data/lib/redis/commands/strings.rb +314 -0
  20. data/lib/redis/commands/transactions.rb +115 -0
  21. data/lib/redis/commands.rb +237 -0
  22. data/lib/redis/distributed.rb +328 -108
  23. data/lib/redis/errors.rb +23 -1
  24. data/lib/redis/hash_ring.rb +36 -79
  25. data/lib/redis/pipeline.rb +69 -83
  26. data/lib/redis/subscribe.rb +26 -19
  27. data/lib/redis/version.rb +3 -1
  28. data/lib/redis.rb +115 -2695
  29. metadata +38 -218
  30. data/.gitignore +0 -16
  31. data/.travis/Gemfile +0 -11
  32. data/.travis.yml +0 -89
  33. data/.yardopts +0 -3
  34. data/Gemfile +0 -4
  35. data/Rakefile +0 -87
  36. data/benchmarking/logging.rb +0 -71
  37. data/benchmarking/pipeline.rb +0 -51
  38. data/benchmarking/speed.rb +0 -21
  39. data/benchmarking/suite.rb +0 -24
  40. data/benchmarking/worker.rb +0 -71
  41. data/examples/basic.rb +0 -15
  42. data/examples/consistency.rb +0 -114
  43. data/examples/dist_redis.rb +0 -43
  44. data/examples/incr-decr.rb +0 -17
  45. data/examples/list.rb +0 -26
  46. data/examples/pubsub.rb +0 -37
  47. data/examples/sentinel/sentinel.conf +0 -9
  48. data/examples/sentinel/start +0 -49
  49. data/examples/sentinel.rb +0 -41
  50. data/examples/sets.rb +0 -36
  51. data/examples/unicorn/config.ru +0 -3
  52. data/examples/unicorn/unicorn.rb +0 -20
  53. data/lib/redis/connection/command_helper.rb +0 -44
  54. data/lib/redis/connection/hiredis.rb +0 -66
  55. data/lib/redis/connection/registry.rb +0 -12
  56. data/lib/redis/connection/ruby.rb +0 -429
  57. data/lib/redis/connection/synchrony.rb +0 -133
  58. data/lib/redis/connection.rb +0 -9
  59. data/redis.gemspec +0 -44
  60. data/test/bitpos_test.rb +0 -69
  61. data/test/blocking_commands_test.rb +0 -42
  62. data/test/client_test.rb +0 -59
  63. data/test/command_map_test.rb +0 -30
  64. data/test/commands_on_hashes_test.rb +0 -21
  65. data/test/commands_on_hyper_log_log_test.rb +0 -21
  66. data/test/commands_on_lists_test.rb +0 -20
  67. data/test/commands_on_sets_test.rb +0 -77
  68. data/test/commands_on_sorted_sets_test.rb +0 -137
  69. data/test/commands_on_strings_test.rb +0 -101
  70. data/test/commands_on_value_types_test.rb +0 -133
  71. data/test/connection_handling_test.rb +0 -277
  72. data/test/connection_test.rb +0 -57
  73. data/test/db/.gitkeep +0 -0
  74. data/test/distributed_blocking_commands_test.rb +0 -46
  75. data/test/distributed_commands_on_hashes_test.rb +0 -10
  76. data/test/distributed_commands_on_hyper_log_log_test.rb +0 -33
  77. data/test/distributed_commands_on_lists_test.rb +0 -22
  78. data/test/distributed_commands_on_sets_test.rb +0 -83
  79. data/test/distributed_commands_on_sorted_sets_test.rb +0 -18
  80. data/test/distributed_commands_on_strings_test.rb +0 -59
  81. data/test/distributed_commands_on_value_types_test.rb +0 -95
  82. data/test/distributed_commands_requiring_clustering_test.rb +0 -164
  83. data/test/distributed_connection_handling_test.rb +0 -23
  84. data/test/distributed_internals_test.rb +0 -79
  85. data/test/distributed_key_tags_test.rb +0 -52
  86. data/test/distributed_persistence_control_commands_test.rb +0 -26
  87. data/test/distributed_publish_subscribe_test.rb +0 -92
  88. data/test/distributed_remote_server_control_commands_test.rb +0 -66
  89. data/test/distributed_scripting_test.rb +0 -102
  90. data/test/distributed_sorting_test.rb +0 -20
  91. data/test/distributed_test.rb +0 -58
  92. data/test/distributed_transactions_test.rb +0 -32
  93. data/test/encoding_test.rb +0 -18
  94. data/test/error_replies_test.rb +0 -59
  95. data/test/fork_safety_test.rb +0 -65
  96. data/test/helper.rb +0 -232
  97. data/test/helper_test.rb +0 -24
  98. data/test/internals_test.rb +0 -417
  99. data/test/lint/blocking_commands.rb +0 -150
  100. data/test/lint/hashes.rb +0 -162
  101. data/test/lint/hyper_log_log.rb +0 -60
  102. data/test/lint/lists.rb +0 -143
  103. data/test/lint/sets.rb +0 -140
  104. data/test/lint/sorted_sets.rb +0 -316
  105. data/test/lint/strings.rb +0 -260
  106. data/test/lint/value_types.rb +0 -122
  107. data/test/persistence_control_commands_test.rb +0 -26
  108. data/test/pipelining_commands_test.rb +0 -242
  109. data/test/publish_subscribe_test.rb +0 -282
  110. data/test/remote_server_control_commands_test.rb +0 -118
  111. data/test/scanning_test.rb +0 -413
  112. data/test/scripting_test.rb +0 -78
  113. data/test/sentinel_command_test.rb +0 -80
  114. data/test/sentinel_test.rb +0 -255
  115. data/test/sorting_test.rb +0 -59
  116. data/test/ssl_test.rb +0 -73
  117. data/test/support/connection/hiredis.rb +0 -1
  118. data/test/support/connection/ruby.rb +0 -1
  119. data/test/support/connection/synchrony.rb +0 -17
  120. data/test/support/redis_mock.rb +0 -130
  121. data/test/support/ssl/gen_certs.sh +0 -31
  122. data/test/support/ssl/trusted-ca.crt +0 -25
  123. data/test/support/ssl/trusted-ca.key +0 -27
  124. data/test/support/ssl/trusted-cert.crt +0 -81
  125. data/test/support/ssl/trusted-cert.key +0 -28
  126. data/test/support/ssl/untrusted-ca.crt +0 -26
  127. data/test/support/ssl/untrusted-ca.key +0 -27
  128. data/test/support/ssl/untrusted-cert.crt +0 -82
  129. data/test/support/ssl/untrusted-cert.key +0 -28
  130. data/test/support/wire/synchrony.rb +0 -24
  131. data/test/support/wire/thread.rb +0 -5
  132. data/test/synchrony_driver.rb +0 -88
  133. data/test/test.conf.erb +0 -9
  134. data/test/thread_safety_test.rb +0 -62
  135. data/test/transactions_test.rb +0 -264
  136. data/test/unknown_commands_test.rb +0 -14
  137. data/test/url_param_test.rb +0 -138
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 729f56810aa501065e2fc203050363713c80ee37
4
- data.tar.gz: e7e13fb75618f794a2c742d73d6c8a72699d5e92
2
+ SHA256:
3
+ metadata.gz: 1dde5fad5c2d0c73c390528b059ab36b185dd61a2c32e4f9be9512bb4516977b
4
+ data.tar.gz: cda581f3f9b0b4238f15b4b3ddf7566fb6ca02b60ee7951b903e8e195bd395cd
5
5
  SHA512:
6
- metadata.gz: f87e76c751760b7f1feb7c859ea373c41ebf805c104c27e85177cb20a60d42b11c50db2d5a916fb7bfc78b82b13141770a851568aea922ccc1970f4e30ba1dea
7
- data.tar.gz: ac4cb236c9c9897d73ead9421e161cf1c7aac2a3c1f77c088b5c52c324cddccda6ab749441093cbcc94ea812e70232f9f9ac1c160a96fd1fbd46d87586d1d7fb
6
+ metadata.gz: 122fd647eda1a251370f32dfefb4711411b0ff9b0e9185cdb871c389c99d5b80a80d554a6b7787ed10e515291b1ebed6dceb2364f8c28021ce6fdedd3297d08e
7
+ data.tar.gz: 13aadc0709a9fc7779ad7ad1f64bb3d3b26da57eb44dd2ebd629d5ed2d34ea17c782337ce92e1047e7ae736df8b90eafb2e935e460f1b1af979621942dad772f
data/CHANGELOG.md CHANGED
@@ -1,8 +1,296 @@
1
+ # Unreleased
2
+
3
+ # 5.0.7
4
+
5
+ - Fix compatibility with `redis-client 0.15.0` when using Redis Sentinel. Fix #1209.
6
+
7
+ # 5.0.6
8
+
9
+ - Wait for an extra `config.read_timeout` in blocking commands rather than an arbitrary 100ms. See #1175.
10
+ - Treat ReadOnlyError as ConnectionError. See #1168.
11
+
12
+ # 5.0.5
13
+
14
+ - Fix automatic disconnection when the process was forked. See #1157.
15
+
16
+ # 5.0.4
17
+
18
+ - Cast `ttl` argument to integer in `expire`, `setex` and a few others.
19
+
20
+ # 5.0.3
21
+
22
+ - Add `OutOfMemoryError` as a subclass of `CommandError`
23
+
24
+ # 5.0.2
25
+
26
+ - Fix `Redis#close` to properly reset the fork protection check.
27
+
28
+ # 5.0.1
29
+
30
+ - Added a fake `Redis::Connections.drivers` method to be compatible with older sidekiq versions.
31
+
32
+ # 5.0.0
33
+
34
+ - Default client timeout decreased from 5 seconds to 1 second.
35
+ - Eagerly and strictly cast Integer and Float parameters.
36
+ - Allow to call `subscribe`, `unsubscribe`, `psubscribe` and `punsubscribe` from a subscribed client. See #1131.
37
+ - Use `MD5` for hashing server nodes in `Redis::Distributed`. This should improve keys distribution among servers. See #1089.
38
+ - Changed `sadd` and `srem` to now always return an Integer.
39
+ - Added `sadd?` and `srem?` which always return a Boolean.
40
+ - Added support for `IDLE` paramter in `xpending`.
41
+ - Cluster support has been moved to a `redis-clustering` companion gem.
42
+ - `select` no longer record the current database. If the client has to reconnect after `select` was used, it will reconnect to the original database.
43
+ - Better support Float timeout in blocking commands. See #977.
44
+ - `Redis.new` will now raise an error if provided unknown options.
45
+ - Removed positional timeout in blocking commands (`BLPOP`, etc). Timeout now must be passed as an option: `r.blpop("key", timeout: 2.5)`
46
+ - Removed `logger` option.
47
+ - Removed `reconnect_delay_max` and `reconnect_delay`, you can pass precise sleep durations to `reconnect_attempts` instead.
48
+ - Require Ruby 2.5+.
49
+ - Removed the deprecated `queue` and `commit` methods. Use `pipelined` instead.
50
+ - Removed the deprecated `Redis::Future#==`.
51
+ - Removed the deprecated `pipelined` and `multi` signature. Commands now MUST be called on the block argument, not the original redis instance.
52
+ - Removed `Redis.current`. You shouldn't assume there is a single global Redis connection, use a connection pool instead,
53
+ and libaries using Redis should accept a Redis instance (or connection pool) as a config. E.g. `MyLibrary.redis = Redis.new(...)`.
54
+ - Removed the `synchrony` driver.
55
+ - Removed `Redis.exists_returns_integer`, it's now always enabled.
56
+
57
+ # 4.8.1
58
+
59
+ * Automatically reconnect after fork regardless of `reconnect_attempts`
60
+
61
+ # 4.8.0
62
+
63
+ * Introduce `sadd?` and `srem?` as boolean returning versions of `sadd` and `srem`.
64
+ * Deprecate `sadd` and `srem` returning a boolean when called with a single argument.
65
+ To enable the redis 5.0 behavior you can set `Redis.sadd_returns_boolean = false`.
66
+ * Deprecate passing `timeout` as a positional argument in blocking commands (`brpop`, `blop`, etc).
67
+
68
+ # 4.7.1
69
+
70
+ * Gracefully handle OpenSSL 3.0 EOF Errors (`OpenSSL::SSL::SSLError: SSL_read: unexpected eof while reading`). See #1106
71
+ This happens frequently on heroku-22.
72
+
73
+ # 4.7.0
74
+
75
+ * Support single endpoint architecture with SSL/TLS in cluster mode. See #1086.
76
+ * `zrem` and `zadd` act as noop when provided an empty list of keys. See #1097.
77
+ * Support IPv6 URLs.
78
+ * Add `Redis#with` for better compatibility with `connection_pool` usage.
79
+ * Fix the block form of `multi` called inside `pipelined`. Previously the `MUTLI/EXEC` wouldn't be sent. See #1073.
80
+
81
+ # 4.6.0
82
+
83
+ * Deprecate `Redis.current`.
84
+ * Deprecate calling commands on `Redis` inside `Redis#pipelined`. See #1059.
85
+ ```ruby
86
+ redis.pipelined do
87
+ redis.get("key")
88
+ end
89
+ ```
90
+
91
+ should be replaced by:
92
+
93
+ ```ruby
94
+ redis.pipelined do |pipeline|
95
+ pipeline.get("key")
96
+ end
97
+ ```
98
+ * Deprecate calling commands on `Redis` inside `Redis#multi`. See #1059.
99
+ ```ruby
100
+ redis.multi do
101
+ redis.get("key")
102
+ end
103
+ ```
104
+
105
+ should be replaced by:
106
+
107
+ ```ruby
108
+ redis.multi do |transaction|
109
+ transaction.get("key")
110
+ end
111
+ ```
112
+ * Deprecate `Redis#queue` and `Redis#commit`. See #1059.
113
+
114
+ * Fix `zpopmax` and `zpopmin` when called inside a pipeline. See #1055.
115
+ * `Redis#synchronize` is now private like it should always have been.
116
+
117
+ * Add `Redis.silence_deprecations=` to turn off deprecation warnings.
118
+ If you don't wish to see warnings yet, you can set `Redis.silence_deprecations = true`.
119
+ It is however heavily recommended to fix them instead when possible.
120
+ * Add `Redis.raise_deprecations=` to turn deprecation warnings into errors.
121
+ This makes it easier to identitify the source of deprecated APIs usage.
122
+ It is recommended to set `Redis.raise_deprecations = true` in development and test environments.
123
+ * Add new options to ZRANGE. See #1053.
124
+ * Add ZRANGESTORE command. See #1053.
125
+ * Add SCAN support for `Redis::Cluster`. See #1049.
126
+ * Add COPY command. See #1053. See #1048.
127
+ * Add ZDIFFSTORE command. See #1046.
128
+ * Add ZDIFF command. See #1044.
129
+ * Add ZUNION command. See #1042.
130
+ * Add HRANDFIELD command. See #1040.
131
+
132
+ # 4.5.1
133
+
134
+ * 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,
135
+ 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.
136
+ This behavior is deprecated and will be removed in Redis 4.6.0. Fix #1038.
137
+
138
+ # 4.5.0
139
+
140
+ * Handle parts of the command using incompatible encodings. See #1037.
141
+ * Add GET option to SET command. See #1036.
142
+ * Add ZRANDMEMBER command. See #1035.
143
+ * Add LMOVE/BLMOVE commands. See #1034.
144
+ * Add ZMSCORE command. See #1032.
145
+ * Add LT/GT options to ZADD. See #1033.
146
+ * Add SMISMEMBER command. See #1031.
147
+ * Add EXAT/PXAT options to SET. See #1028.
148
+ * Add GETDEL/GETEX commands. See #1024.
149
+ * `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`.
150
+ * Fix Redis < 6 detection during connect. See #1025.
151
+ * Fix fetching command details in Redis cluster when the first node is unhealthy. See #1026.
152
+
153
+ # 4.4.0
154
+
155
+ * Redis cluster: fix cross-slot validation in pipelines. Fix ##1019.
156
+ * Add support for `XAUTOCLAIM`. See #1018.
157
+ * Properly issue `READONLY` when reconnecting to replicas. Fix #1017.
158
+ * Make `del` a noop if passed an empty list of keys. See #998.
159
+ * Add support for `ZINTER`. See #995.
160
+
161
+ # 4.3.1
162
+
163
+ * Fix password authentication against redis server 5 and older.
164
+
165
+ # 4.3.0
166
+
167
+ * Add the TYPE argument to scan and scan_each. See #985.
168
+ * Support AUTH command for ACL. See #967.
169
+
170
+ # 4.2.5
171
+
172
+ * Optimize the ruby connector write buffering. See #964.
173
+
174
+ # 4.2.4
175
+
176
+ * Fix bytesize calculations in the ruby connector, and work on a copy of the buffer. Fix #961, #962.
177
+
178
+ # 4.2.3
179
+
180
+ * Use io/wait instead of IO.select in the ruby connector. See #960.
181
+ * Use exception free non blocking IOs in the ruby connector. See #926.
182
+ * Prevent corruption of the client when an interrupt happen during inside a pipeline block. See #945.
183
+
184
+ # 4.2.2
185
+
186
+ * Fix `WATCH` support for `Redis::Distributed`. See #941.
187
+ * Fix handling of empty stream responses. See #905, #929.
188
+
189
+ # 4.2.1
190
+
191
+ * Fix `exists?` returning an actual boolean when called with multiple keys. See #918.
192
+ * Setting `Redis.exists_returns_integer = false` disables warning message about new behaviour. See #920.
193
+
194
+ # 4.2.0
195
+
196
+ * Convert commands to accept keyword arguments rather than option hashes. This both help catching typos, and reduce needless allocations.
197
+ * Deprecate the synchrony driver. It will be removed in 5.0 and hopefully maintained as a separate gem. See #915.
198
+ * Make `Redis#exists` variadic, will return an Integer if called with multiple keys.
199
+ * Add `Redis#exists?` to get a Boolean if any of the keys exists.
200
+ * `Redis#exists` when called with a single key will warn that future versions will return an Integer.
201
+ Set `Redis.exists_returns_integer = true` to opt-in to the new behavior.
202
+ * Support `keepttl` ooption in `set`. See #913.
203
+ * Optimized initialization of Redis::Cluster. See #912.
204
+ * Accept sentinel options even with string key. See #599.
205
+ * Verify TLS connections by default. See #900.
206
+ * Make `Redis#hset` variadic. It now returns an integer, not a boolean. See #910.
207
+
208
+ # 4.1.4
209
+
210
+ * Alias `Redis#disconnect` as `#close`. See #901.
211
+ * Handle clusters with multiple slot ranges. See #894.
212
+ * Fix password authentication to a redis cluster. See #889.
213
+ * Handle recursive MOVED responses. See #882.
214
+ * Increase buffer size in the ruby connector. See #880.
215
+ * Fix thread safety of `Redis.queue`. See #878.
216
+ * Deprecate `Redis::Future#==` as it's likely to be a mistake. See #876.
217
+ * Support `KEEPTTL` option for SET command. See #913.
218
+
219
+ # 4.1.3
220
+
221
+ * Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
222
+
223
+ # 4.1.2
224
+
225
+ * Fix several authentication problems with sentinel. See #850 and #856.
226
+ * Explicitly drop Ruby 2.2 support.
227
+
228
+
229
+ # 4.1.1
230
+
231
+ * Fix error handling in multi blocks. See #754.
232
+ * Fix geoadd to accept arrays like georadius and georadiusbymember. See #841.
233
+ * Fix georadius command failing when long == lat. See #841.
234
+ * Fix timeout error in xread block: 0. See #837.
235
+ * Fix incompatibility issue with redis-objects. See #834.
236
+ * Properly handle Errno::EADDRNOTAVAIL on connect.
237
+ * Fix password authentication to sentinel instances. See #813.
238
+
239
+ # 4.1.0
240
+
241
+ * Add Redis Cluster support. See #716.
242
+ * Add streams support. See #799 and #811.
243
+ * Add ZPOP* support. See #812.
244
+ * Fix issues with integer-like objects as BPOP timeout
245
+
246
+ # 4.0.3
247
+
248
+ * Fix raising command error for first command in pipeline. See #788.
249
+ * Fix the gemspec to stop exposing a `build` executable. See #785.
250
+ * Add `:reconnect_delay` and `:reconnect_delay_max` options. See #778.
251
+
252
+ # 4.0.2
253
+
254
+ * Added `Redis#unlink`. See #766.
255
+
256
+ * `Redis.new` now accept a custom connector via `:connector`. See #591.
257
+
258
+ * `Redis#multi` no longer perform empty transactions. See #747.
259
+
260
+ * `Redis#hdel` now accepts hash keys as multiple arguments like `#del`. See #755.
261
+
262
+ * Allow to skip SSL verification. See #745.
263
+
264
+ * Add Geo commands: `geoadd`, `geohash`, `georadius`, `georadiusbymember`, `geopos`, `geodist`. See #730.
265
+
266
+ # 4.0.1
267
+
268
+ * `Redis::Distributed` now supports `mget` and `mapped_mget`. See #687.
269
+
270
+ * `Redis::Distributed` now supports `sscan` and `sscan_each`. See #572.
271
+
272
+ * `Redis#connection` returns a hash with connection information.
273
+ You shouldn't need to call `Redis#_client`, ever.
274
+
275
+ * `Redis#flushdb` and `Redis#flushall` now support the `:async` option. See #706.
276
+
277
+
278
+ # 4.0
279
+
280
+ * Removed `Redis.connect`. Use `Redis.new`.
281
+
282
+ * Removed `Redis#[]` and `Redis#[]=` aliases.
283
+
284
+ * Added support for `CLIENT` commands. The lower-level client can be
285
+ accessed via `Redis#_client`.
286
+
287
+ * Dropped official support for Ruby < 2.2.2.
288
+
1
289
  # 3.3.5
2
290
 
3
291
  * Fixed Ruby 1.8 compatibility after backporting `Redis#connection`. See #719.
4
292
 
5
- # 3.3.4
293
+ # 3.3.4 (yanked)
6
294
 
7
295
  * `Redis#connection` returns a hash with connection information.
8
296
  You shouldn't need to call `Redis#_client`, ever.
@@ -13,7 +301,7 @@
13
301
 
14
302
  # 3.3.2
15
303
 
16
- * Added support for SPOP with COUNT. See #628.
304
+ * Added support for `SPOP` with COUNT. See #628.
17
305
 
18
306
  * Fixed connection glitches when using SSL. See #644.
19
307