Skip to content

Commit b40f42d

Browse files
committed
Merge remote-tracking branch 'origin/master' into 4.0
2 parents 478c404 + 06665e6 commit b40f42d

File tree

13 files changed

+100
-20
lines changed

13 files changed

+100
-20
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ rvm:
66
- 2.1
77
- 2.2
88
- 2.3.3
9+
- 2.4.1
910
- jruby-9
1011
- rbx-3
1112

1213
gemfile: ".travis/Gemfile"
1314

1415
sudo: false
1516

17+
before_script:
18+
- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT
19+
1620
env:
1721
global:
1822
- VERBOSE=true
@@ -28,6 +32,8 @@ env:
2832

2933
branches:
3034
only:
35+
- staging
36+
- trying
3137
- master
3238

3339
matrix:

.travis/Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ source "https://rubygems.org"
22

33
gemspec :path => "../"
44

5-
case ENV["conn"]
5+
case ENV["DRIVER"]
66
when "hiredis"
77
gem "hiredis"
88
when "synchrony"
99
gem "hiredis"
1010
gem "em-synchrony"
1111
end
12+
13+
gem 'test-unit', '>= 3.2.5'

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* Added support for `CLIENT` commands. The lower-level client can be
88
accessed via `Redis#_client`.
99

10+
# 3.3.3
11+
12+
* Improved timeout handling after dropping Timeout module.
13+
1014
# 3.3.2
1115

1216
* Added support for `SPOP` with COUNT. See #628.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ client and evangelized Redis in Rubyland. Thank you, Ezra.
355355
requests. You can also ask for help at `#redis-rb` on Freenode.
356356

357357

358-
[inchpages-image]: https://inch-ci.org/github/redis/redis-rb.png
358+
[inchpages-image]: https://inch-ci.org/github/redis/redis-rb.svg
359359
[inchpages-link]: https://inch-ci.org/github/redis/redis-rb
360-
[redis-commands]: http://redis.io/commands
361-
[redis-home]: http://redis.io
360+
[redis-commands]: https://redis.io/commands
361+
[redis-home]: https://redis.io
362362
[redis-url]: http://www.iana.org/assignments/uri-schemes/prov/redis
363363
[travis-home]: https://travis-ci.org/
364-
[travis-image]: https://secure.travis-ci.org/redis/redis-rb.png?branch=master
364+
[travis-image]: https://secure.travis-ci.org/redis/redis-rb.svg?branch=master
365365
[travis-link]: https://travis-ci.org/redis/redis-rb
366-
[rubydoc]: http://www.rubydoc.info/gems/redis
366+
[rubydoc]: https://www.rubydoc.info/gems/redis

bors.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Gate on Travis CI
2+
status = ["continuous-integration/travis-ci/push"]
3+
4+
# Set bors's timeout to 6 hours
5+
#
6+
# bors's timeout should always be twice a long as the test suite takes.
7+
# This is to allow Travis to fast-fail a test; if one of the builders
8+
# immediately reports a failure, then bors will move on to the next batch,
9+
# leaving the slower builders to work through the already-doomed run and
10+
# the next one.
11+
#
12+
# At the time it was written, a run had taken 3 hours.
13+
# bors's default timeout is 4 hours.
14+
timeout_sec = 14400

lib/redis.rb

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ def select(db)
134134

135135
# Ping the server.
136136
#
137+
# @param [optional, String] message
137138
# @return [String] `PONG`
138-
def ping
139+
def ping(message = nil)
139140
synchronize do |client|
140-
client.call([:ping])
141+
client.call([:ping, message].compact)
141142
end
142143
end
143144

@@ -468,10 +469,16 @@ def dump(key)
468469
# @param [String] key
469470
# @param [String] ttl
470471
# @param [String] serialized_value
472+
# @param [Hash] options
473+
# - `:replace => Boolean`: if false, raises an error if key already exists
474+
# @raise [Redis::CommandError]
471475
# @return [String] `"OK"`
472-
def restore(key, ttl, serialized_value)
476+
def restore(key, ttl, serialized_value, options = {})
477+
args = [:restore, key, ttl, serialized_value]
478+
args << 'REPLACE' if options[:replace]
479+
473480
synchronize do |client|
474-
client.call([:restore, key, ttl, serialized_value])
481+
client.call(args)
475482
end
476483
end
477484

@@ -1047,7 +1054,7 @@ def llen(key)
10471054
# Prepend one or more values to a list, creating the list if it doesn't exist
10481055
#
10491056
# @param [String] key
1050-
# @param [String, Array] value string value, or array of string values to push
1057+
# @param [String, Array<String>] value string value, or array of string values to push
10511058
# @return [Fixnum] the length of the list after the push operation
10521059
def lpush(key, value)
10531060
synchronize do |client|
@@ -1069,7 +1076,7 @@ def lpushx(key, value)
10691076
# Append one or more values to a list, creating the list if it doesn't exist
10701077
#
10711078
# @param [String] key
1072-
# @param [String] value
1079+
# @param [String, Array<String>] value string value, or array of string values to push
10731080
# @return [Fixnum] the length of the list after the push operation
10741081
def rpush(key, value)
10751082
synchronize do |client|
@@ -1707,6 +1714,30 @@ def zremrangebyrank(key, start, stop)
17071714
end
17081715
end
17091716

1717+
# Count the members, with the same score in a sorted set, within the given lexicographical range.
1718+
#
1719+
# @example Count members matching a
1720+
# redis.zlexcount("zset", "[a", "[a\xff")
1721+
# # => 1
1722+
# @example Count members matching a-z
1723+
# redis.zlexcount("zset", "[a", "[z\xff")
1724+
# # => 26
1725+
#
1726+
# @param [String] key
1727+
# @param [String] min
1728+
# - inclusive minimum is specified by prefixing `(`
1729+
# - exclusive minimum is specified by prefixing `[`
1730+
# @param [String] max
1731+
# - inclusive maximum is specified by prefixing `(`
1732+
# - exclusive maximum is specified by prefixing `[`
1733+
#
1734+
# @return [Fixnum] number of members within the specified lexicographical range
1735+
def zlexcount(key, min, max)
1736+
synchronize do |client|
1737+
client.call([:zlexcount, key, min, max])
1738+
end
1739+
end
1740+
17101741
# Return a range of members with the same score in a sorted set, by lexicographical ordering
17111742
#
17121743
# @example Retrieve members matching a

lib/redis/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,12 @@ def _parse_options(options)
450450
case options[:tcp_keepalive]
451451
when Hash
452452
[:time, :intvl, :probes].each do |key|
453-
unless options[:tcp_keepalive][key].is_a?(Fixnum)
454-
raise "Expected the #{key.inspect} key in :tcp_keepalive to be a Fixnum"
453+
unless options[:tcp_keepalive][key].is_a?(Integer)
454+
raise "Expected the #{key.inspect} key in :tcp_keepalive to be an Integer"
455455
end
456456
end
457457

458-
when Fixnum
458+
when Integer
459459
if options[:tcp_keepalive] >= 60
460460
options[:tcp_keepalive] = {:time => options[:tcp_keepalive] - 20, :intvl => 10, :probes => 2}
461461

lib/redis/connection/ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(*args)
2020
super(*args)
2121

2222
@timeout = @write_timeout = nil
23-
@buffer = ""
23+
@buffer = "".dup
2424
end
2525

2626
def timeout=(timeout)

lib/redis/distributed.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def dump(key)
144144
end
145145

146146
# Create a key using the serialized value, previously obtained using DUMP.
147-
def restore(key, ttl, serialized_value)
148-
node_for(key).restore(key, ttl, serialized_value)
147+
def restore(key, ttl, serialized_value, options = {})
148+
node_for(key).restore(key, ttl, serialized_value, options)
149149
end
150150

151151
# Transfer a key from the connected instance to another instance.

redis.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
3434
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
3535
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
3636

37-
s.add_development_dependency("test-unit", "3.1.5")
37+
s.add_development_dependency("test-unit", ">= 3.1.5")
3838
s.add_development_dependency("hiredis")
3939
s.add_development_dependency("em-synchrony")
4040
end

0 commit comments

Comments
 (0)