redis 3.3.3 → 5.0.5

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