Skip to content

Commit 60971a1

Browse files
authored
Merge pull request #653 from redis/4.0
4.0
2 parents 06665e6 + de19bd9 commit 60971a1

File tree

76 files changed

+530
-854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+530
-854
lines changed

.travis.yml

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
language: ruby
22

3+
script: make test
4+
35
rvm:
4-
- 1.8.7
5-
- 1.9.3
6-
- 2.0
7-
- 2.1
8-
- 2.2
9-
- 2.3.0
6+
- 2.2.2
7+
- 2.3.3
108
- 2.4.1
11-
- jruby-18mode
12-
- jruby-19mode
13-
- jruby-9.0.5.0
14-
- rbx-2
9+
- jruby-9
10+
- rbx-3
1511

1612
gemfile: ".travis/Gemfile"
1713

@@ -25,13 +21,13 @@ env:
2521
- VERBOSE=true
2622
- TIMEOUT=1
2723
matrix:
28-
- conn=ruby REDIS_BRANCH=3.0
29-
- conn=ruby REDIS_BRANCH=3.2
30-
- conn=hiredis REDIS_BRANCH=3.0
31-
- conn=hiredis REDIS_BRANCH=3.2
32-
- conn=synchrony REDIS_BRANCH=3.0
33-
- conn=synchrony REDIS_BRANCH=3.2
34-
- conn=ruby REDIS_BRANCH=unstable
24+
- DRIVER=ruby REDIS_BRANCH=3.0
25+
- DRIVER=ruby REDIS_BRANCH=3.2
26+
- DRIVER=hiredis REDIS_BRANCH=3.0
27+
- DRIVER=hiredis REDIS_BRANCH=3.2
28+
- DRIVER=synchrony REDIS_BRANCH=3.0
29+
- DRIVER=synchrony REDIS_BRANCH=3.2
30+
- DRIVER=ruby REDIS_BRANCH=unstable
3531

3632
branches:
3733
only:
@@ -42,52 +38,34 @@ branches:
4238
matrix:
4339
exclude:
4440
# hiredis
45-
- rvm: jruby-18mode
46-
gemfile: .travis/Gemfile
47-
env: conn=hiredis REDIS_BRANCH=3.0
48-
- rvm: jruby-18mode
41+
- rvm: jruby-9
4942
gemfile: .travis/Gemfile
50-
env: conn=hiredis REDIS_BRANCH=3.2
51-
- rvm: jruby-19mode
43+
env: DRIVER=hiredis REDIS_BRANCH=3.0
44+
- rvm: jruby-9
5245
gemfile: .travis/Gemfile
53-
env: conn=hiredis REDIS_BRANCH=3.0
54-
- rvm: jruby-19mode
46+
env: DRIVER=hiredis REDIS_BRANCH=3.2
47+
- rvm: jruby-9
5548
gemfile: .travis/Gemfile
56-
env: conn=hiredis REDIS_BRANCH=3.2
57-
- rvm: jruby-9.0.5.0
49+
env: DRIVER=hiredis REDIS_BRANCH=3.0
50+
- rvm: jruby-9
5851
gemfile: .travis/Gemfile
59-
env: conn=hiredis REDIS_BRANCH=3.0
60-
- rvm: jruby-9.0.5.0
61-
gemfile: .travis/Gemfile
62-
env: conn=hiredis REDIS_BRANCH=3.2
52+
env: DRIVER=hiredis REDIS_BRANCH=3.2
6353

6454
# synchrony
65-
- rvm: 1.8.7
66-
gemfile: .travis/Gemfile
67-
env: conn=synchrony REDIS_BRANCH=3.0
68-
- rvm: 1.8.7
69-
gemfile: .travis/Gemfile
70-
env: conn=synchrony REDIS_BRANCH=3.2
71-
- rvm: jruby-18mode
72-
gemfile: .travis/Gemfile
73-
env: conn=synchrony REDIS_BRANCH=3.0
74-
- rvm: jruby-18mode
75-
gemfile: .travis/Gemfile
76-
env: conn=synchrony REDIS_BRANCH=3.2
77-
- rvm: jruby-19mode
55+
- rvm: jruby-9
7856
gemfile: .travis/Gemfile
79-
env: conn=synchrony REDIS_BRANCH=3.0
80-
- rvm: jruby-19mode
57+
env: DRIVER=synchrony REDIS_BRANCH=3.0
58+
- rvm: jruby-9
8159
gemfile: .travis/Gemfile
82-
env: conn=synchrony REDIS_BRANCH=3.2
83-
- rvm: jruby-9.0.5.0
60+
env: DRIVER=synchrony REDIS_BRANCH=3.2
61+
- rvm: jruby-9
8462
gemfile: .travis/Gemfile
85-
env: conn=synchrony REDIS_BRANCH=3.0
86-
- rvm: jruby-9.0.5.0
63+
env: DRIVER=synchrony REDIS_BRANCH=3.0
64+
- rvm: jruby-9
8765
gemfile: .travis/Gemfile
88-
env: conn=synchrony REDIS_BRANCH=3.2
66+
env: DRIVER=synchrony REDIS_BRANCH=3.2
8967
allow_failures:
90-
- rvm: rbx-2
68+
- rvm: rbx-3
9169

9270
notifications:
9371
irc:

.travis/Gemfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +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
1212

13-
if RUBY_VERSION.to_f < 1.9
14-
gem 'test-unit', '3.1.5'
15-
else
16-
gem 'test-unit', '>= 3.2.5'
17-
end
13+
gem 'test-unit', '>= 3.2.5'

CHANGELOG.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
# 4.x (unreleased)
1+
# 4.0 (unreleased)
22

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+
* Removed `Redis.connect`. Use `Redis.new`.
94

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+
* Removed `Redis#[]` and `Redis#[]=` aliases.
6+
7+
* Added support for `CLIENT` commands. The lower-level client can be
8+
accessed via `Redis#_client`.
9+
10+
* Dropped official support for Ruby < 2.2.2.
1411

1512
# 3.3.3
1613

1714
* Improved timeout handling after dropping Timeout module.
1815

1916
# 3.3.2
2017

21-
* Added support for SPOP with COUNT. See #628.
18+
* Added support for `SPOP` with COUNT. See #628.
2219

2320
* Fixed connection glitches when using SSL. See #644.
2421

Gemfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# encoding: utf-8
21
source 'https://rubygems.org'
32

43
gemspec
5-
6-
if RUBY_VERSION.to_f < 1.9
7-
gem 'test-unit', '3.1.5'
8-
else
9-
gem 'test-unit', '>= 3.2.5'
10-
end

README.md

Lines changed: 31 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
11
# redis-rb [![Build Status][travis-image]][travis-link] [![Inline docs][inchpages-image]][inchpages-link]
22

3-
[travis-image]: https://secure.travis-ci.org/redis/redis-rb.svg?branch=master
4-
[travis-link]: http://travis-ci.org/redis/redis-rb
5-
[travis-home]: http://travis-ci.org/
6-
[inchpages-image]: http://inch-ci.org/github/redis/redis-rb.svg
7-
[inchpages-link]: http://inch-ci.org/github/redis/redis-rb
3+
A Ruby client that tries to match [Redis][redis-home]' API one-to-one, while still
4+
providing an idiomatic interface.
85

9-
A Ruby client library for [Redis][redis-home].
10-
11-
[redis-home]: http://redis.io
12-
13-
A Ruby client that tries to match Redis' API one-to-one, while still
14-
providing an idiomatic interface. It features thread-safety, client-side
15-
sharding, pipelining, and an obsession for performance.
16-
17-
## Upgrading from 2.x to 3.0
18-
19-
Please refer to the [CHANGELOG][changelog-3.0.0] for a summary of the
20-
most important changes, as well as a full list of changes.
21-
22-
[changelog-3.0.0]: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md#300
236

247
## Getting started
258

26-
To install **redis-rb**, run the following command:
27-
28-
```
29-
gem install redis
30-
```
31-
32-
Or if you are using **bundler**, add
9+
Install with:
3310

3411
```
35-
gem 'redis', '~>3.2'
12+
$ gem install redis
3613
```
3714

38-
to your `Gemfile`, and run `bundle install`
39-
40-
As of version 2.0 this client only targets Redis version 2.0 and higher.
41-
You can use an older version of this client if you need to interface
42-
with a Redis instance older than 2.0, but this is no longer supported.
43-
4415
You can connect to Redis by instantiating the `Redis` class:
4516

4617
```ruby
@@ -54,40 +25,36 @@ listening on `localhost`, port 6379. If you need to connect to a remote
5425
server or a different port, try:
5526

5627
```ruby
57-
redis = Redis.new(:host => "10.0.1.1", :port => 6380, :db => 15)
28+
redis = Redis.new(host: "10.0.1.1", port: 6380, db: 15)
5829
```
5930

6031
You can also specify connection options as a [`redis://` URL][redis-url]:
6132

6233
```ruby
63-
redis = Redis.new(:url => "redis://:[email protected]:6380/15")
34+
redis = Redis.new(url: "redis://:[email protected]:6380/15")
6435
```
6536

66-
[redis-url]: http://www.iana.org/assignments/uri-schemes/prov/redis
67-
6837
By default, the client will try to read the `REDIS_URL` environment variable
6938
and use that as URL to connect to. The above statement is therefore equivalent
7039
to setting this environment variable and calling `Redis.new` without arguments.
7140

7241
To connect to Redis listening on a Unix socket, try:
7342

7443
```ruby
75-
redis = Redis.new(:path => "/tmp/redis.sock")
44+
redis = Redis.new(path: "/tmp/redis.sock")
7645
```
7746

7847
To connect to a password protected Redis instance, use:
7948

8049
```ruby
81-
redis = Redis.new(:password => "mysecret")
50+
redis = Redis.new(password: "mysecret")
8251
```
8352

8453
The Redis class exports methods that are named identical to the commands
8554
they execute. The arguments these methods accept are often identical to
8655
the arguments specified on the [Redis website][redis-commands]. For
8756
instance, the `SET` and `GET` commands can be called like this:
8857

89-
[redis-commands]: http://redis.io/commands
90-
9158
```ruby
9259
redis.set("mykey", "hello world")
9360
# => "OK"
@@ -96,24 +63,22 @@ redis.get("mykey")
9663
# => "hello world"
9764
```
9865

99-
All commands, their arguments and return values are documented, and
100-
available on [rdoc.info][rdoc].
101-
102-
[rdoc]: http://rdoc.info/github/redis/redis-rb/
66+
All commands, their arguments, and return values are documented and
67+
available on [RubyDoc.info][rubydoc].
10368

10469
## Sentinel support
10570

106-
The client is able to perform automatic failovers by using [Redis
71+
The client is able to perform automatic failover by using [Redis
10772
Sentinel](http://redis.io/topics/sentinel). Make sure to run Redis 2.8+
10873
if you want to use this feature.
10974

11075
To connect using Sentinel, use:
11176

11277
```ruby
113-
SENTINELS = [{:host => "127.0.0.1", :port => 26380},
114-
{:host => "127.0.0.1", :port => 26381}]
78+
SENTINELS = [{ host: "127.0.0.1", port: 26380 },
79+
{ host: "127.0.0.1", port: 26381 }]
11580

116-
redis = Redis.new(:url => "redis://mymaster", :sentinels => SENTINELS, :role => :master)
81+
redis = Redis.new(url: "redis://mymaster", sentinels: SENTINELS, role: :master)
11782
```
11883

11984
* The master name identifies a group of Redis instances composed of a master
@@ -374,37 +339,28 @@ redis = Redis.new(:driver => :synchrony)
374339

375340
## Testing
376341

377-
This library is tested using [Travis][travis-home], where it is tested
378-
against the following interpreters and drivers:
379-
380-
* MRI 1.8.7 (drivers: ruby, hiredis)
381-
* MRI 1.9.3 (drivers: ruby, hiredis, synchrony)
382-
* MRI 2.0 (drivers: ruby, hiredis, synchrony)
383-
* MRI 2.1 (drivers: ruby, hiredis, synchrony)
384-
* MRI 2.2 (drivers: ruby, hiredis, synchrony)
385-
* MRI 2.3 (drivers: ruby, hiredis, synchrony)
386-
* JRuby 1.7 (1.8 mode) (drivers: ruby)
387-
* JRuby 1.7 (1.9 mode) (drivers: ruby)
342+
This library is tested against recent Ruby and Redis versions.
343+
Check [Travis][travis-link] for the exact versions supported.
388344

389345
## Contributors
390346

391-
(ordered chronologically with more than 5 commits, see `git shortlog -sn` for
392-
all contributors)
393-
394-
* Ezra Zygmuntowicz
395-
* Taylor Weibley
396-
* Matthew Clark
397-
* Brian McKinney
398-
* Luca Guidi
399-
* Salvatore Sanfilippo
400-
* Chris Wanstrath
401-
* Damian Janowski
402-
* Michel Martens
403-
* Nick Quaranto
404-
* Pieter Noordhuis
405-
* Ilya Grigorik
347+
Several people contributed to redis-rb, but we would like to especially
348+
mention Ezra Zygmuntowicz. Ezra introduced the Ruby community to many
349+
new cool technologies, like Redis. He wrote the first version of this
350+
client and evangelized Redis in Rubyland. Thank you, Ezra.
406351

407352
## Contributing
408353

409354
[Fork the project](https://github.com/redis/redis-rb) and send pull
410355
requests. You can also ask for help at `#redis-rb` on Freenode.
356+
357+
358+
[inchpages-image]: https://inch-ci.org/github/redis/redis-rb.svg
359+
[inchpages-link]: https://inch-ci.org/github/redis/redis-rb
360+
[redis-commands]: https://redis.io/commands
361+
[redis-home]: https://redis.io
362+
[redis-url]: http://www.iana.org/assignments/uri-schemes/prov/redis
363+
[travis-home]: https://travis-ci.org/
364+
[travis-image]: https://secure.travis-ci.org/redis/redis-rb.svg?branch=master
365+
[travis-link]: https://travis-ci.org/redis/redis-rb
366+
[rubydoc]: https://www.rubydoc.info/gems/redis

0 commit comments

Comments
 (0)