Skip to content

4.0 #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Aug 25, 2017
Merged

4.0 #653

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
aeadcc1
Add support for CLIENT commands
bitterb Feb 2, 2013
895cc32
Remove Redis.connect.
djanowski Oct 31, 2015
c61ad43
Remove Redis#[] and Redis#[]=.
djanowski Oct 31, 2015
5fd2630
Remove 1.8-ism.
djanowski Oct 31, 2015
0e1574f
Remove checks for Encoding.
djanowski Oct 31, 2015
9d7944e
Remove encoding mark.
djanowski Oct 31, 2015
f3bc68f
Use require_relative.
djanowski Oct 31, 2015
c4ebeda
Remove Redis::Distributed.
djanowski Oct 31, 2015
1feeab7
Switch to Makefile.
djanowski Nov 1, 2015
3f966c9
Remove the deep dup in Client#options
byroot Nov 16, 2015
1ba25a4
Merge master into 4.0
djanowski Oct 14, 2016
5f34d8c
Clean up test helper.
djanowski Oct 14, 2016
0c0d5ca
Remove unreliable test.
djanowski Oct 14, 2016
f8a00f5
Merge remote-tracking branch 'origin/master' into 4.0
djanowski Nov 23, 2016
ca1131d
Merge branch 'fix_write_to_socket' of quixoten/redis-rb into 4.0
djanowski Nov 23, 2016
c28de9b
This no longer needed.
djanowski Nov 23, 2016
e8f0311
Not targeting 1.8.
djanowski Nov 23, 2016
67429c3
Fix warnings.
djanowski Nov 23, 2016
a98f3a6
More traces of 1.8.
djanowski Nov 23, 2016
50f130d
Apparently require_relative doesn't work in gemspec.
djanowski Nov 24, 2016
c239abb
The underlying client is now `_client`.
djanowski Nov 24, 2016
23cf899
Merge branch 'add-client-commands' of bitterb/redis-rb into 4.0
djanowski Nov 24, 2016
3138507
No longer caring about backwards compatibility for Redis#client.
djanowski Nov 24, 2016
5ec801d
Update changelog for CLIENT commands.
djanowski Nov 24, 2016
1529bda
Using make.
djanowski Nov 24, 2016
8a1e6c8
Our new support matrix.
djanowski Nov 24, 2016
39fa0f7
Fix requires.
djanowski Nov 24, 2016
9cd7510
Refreshments.
djanowski Nov 24, 2016
36af474
Fix up requires and confusing environment variable names.
djanowski Nov 24, 2016
31919c2
Try Ruby 2.3 with latest rvm.
djanowski Nov 24, 2016
06d383f
No skip.
djanowski Nov 24, 2016
113ad0c
4.0.0 RC1.
djanowski Nov 24, 2016
e8317bc
Travis, let's try specifying the exact 2.3 version.
djanowski Nov 24, 2016
c6a7a6c
Wrap exceptions for missing socket with CannotConnectError
sallustfire Nov 30, 2016
ac5fbde
Bring back Redis::Distributed.
djanowski Aug 25, 2017
015a4fb
Drop unnecessary C code.
djanowski Aug 25, 2017
ba9a265
Merge branch '4.0-socket-error' of https://github.com/sallustfire/red…
djanowski Aug 25, 2017
478c404
Merge branch 'no-deep-dup' of https://github.com/byroot/redis-rb into…
djanowski Aug 25, 2017
b40f42d
Merge remote-tracking branch 'origin/master' into 4.0
djanowski Aug 25, 2017
af499f0
Dropping official support for Ruby < 2.2.2.
djanowski Aug 25, 2017
de19bd9
Fix connection refused error wrapping when using Synchrony.
djanowski Aug 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 30 additions & 52 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
language: ruby

script: make test

rvm:
- 1.8.7
- 1.9.3
- 2.0
- 2.1
- 2.2
- 2.3.0
- 2.2.2
- 2.3.3
- 2.4.1
- jruby-18mode
- jruby-19mode
- jruby-9.0.5.0
- rbx-2
- jruby-9
- rbx-3

gemfile: ".travis/Gemfile"

Expand All @@ -25,13 +21,13 @@ env:
- VERBOSE=true
- TIMEOUT=1
matrix:
- conn=ruby REDIS_BRANCH=3.0
- conn=ruby REDIS_BRANCH=3.2
- conn=hiredis REDIS_BRANCH=3.0
- conn=hiredis REDIS_BRANCH=3.2
- conn=synchrony REDIS_BRANCH=3.0
- conn=synchrony REDIS_BRANCH=3.2
- conn=ruby REDIS_BRANCH=unstable
- DRIVER=ruby REDIS_BRANCH=3.0
- DRIVER=ruby REDIS_BRANCH=3.2
- DRIVER=hiredis REDIS_BRANCH=3.0
- DRIVER=hiredis REDIS_BRANCH=3.2
- DRIVER=synchrony REDIS_BRANCH=3.0
- DRIVER=synchrony REDIS_BRANCH=3.2
- DRIVER=ruby REDIS_BRANCH=unstable

branches:
only:
Expand All @@ -42,52 +38,34 @@ branches:
matrix:
exclude:
# hiredis
- rvm: jruby-18mode
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.0
- rvm: jruby-18mode
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.2
- rvm: jruby-19mode
env: DRIVER=hiredis REDIS_BRANCH=3.0
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.0
- rvm: jruby-19mode
env: DRIVER=hiredis REDIS_BRANCH=3.2
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.2
- rvm: jruby-9.0.5.0
env: DRIVER=hiredis REDIS_BRANCH=3.0
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.0
- rvm: jruby-9.0.5.0
gemfile: .travis/Gemfile
env: conn=hiredis REDIS_BRANCH=3.2
env: DRIVER=hiredis REDIS_BRANCH=3.2

# synchrony
- rvm: 1.8.7
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.0
- rvm: 1.8.7
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.2
- rvm: jruby-18mode
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.0
- rvm: jruby-18mode
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.2
- rvm: jruby-19mode
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.0
- rvm: jruby-19mode
env: DRIVER=synchrony REDIS_BRANCH=3.0
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.2
- rvm: jruby-9.0.5.0
env: DRIVER=synchrony REDIS_BRANCH=3.2
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.0
- rvm: jruby-9.0.5.0
env: DRIVER=synchrony REDIS_BRANCH=3.0
- rvm: jruby-9
gemfile: .travis/Gemfile
env: conn=synchrony REDIS_BRANCH=3.2
env: DRIVER=synchrony REDIS_BRANCH=3.2
allow_failures:
- rvm: rbx-2
- rvm: rbx-3

notifications:
irc:
Expand Down
8 changes: 2 additions & 6 deletions .travis/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ source "https://rubygems.org"

gemspec :path => "../"

case ENV["conn"]
case ENV["DRIVER"]
when "hiredis"
gem "hiredis"
when "synchrony"
gem "hiredis"
gem "em-synchrony"
end

if RUBY_VERSION.to_f < 1.9
gem 'test-unit', '3.1.5'
else
gem 'test-unit', '>= 3.2.5'
end
gem 'test-unit', '>= 3.2.5'
21 changes: 9 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# 4.x (unreleased)
# 4.0 (unreleased)

## Planned breaking changes:
* `Redis#client` will no longer expose the underlying `Redis::Client`;
it has not yet been determined how 4.0 will expose the underlying
functionality, but we will make every attempt to provide a final minor
release of 3.x that provides the new interfaces in order to facilitate
a smooth transition.
* Removed `Redis.connect`. Use `Redis.new`.

* Ruby 1.8.7 (and the 1.8 modes of JRuby and Rubinius) will no longer be
supported; 1.8.x entered end-of-life in June of 2012 and stopped receiving
security updates in June of 2013; continuing to support it would prevent
the use of newer features of Ruby.
* Removed `Redis#[]` and `Redis#[]=` aliases.

* Added support for `CLIENT` commands. The lower-level client can be
accessed via `Redis#_client`.

* Dropped official support for Ruby < 2.2.2.

# 3.3.3

* Improved timeout handling after dropping Timeout module.

# 3.3.2

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

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

Expand Down
7 changes: 0 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# encoding: utf-8
source 'https://rubygems.org'

gemspec

if RUBY_VERSION.to_f < 1.9
gem 'test-unit', '3.1.5'
else
gem 'test-unit', '>= 3.2.5'
end
106 changes: 31 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
# redis-rb [![Build Status][travis-image]][travis-link] [![Inline docs][inchpages-image]][inchpages-link]

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

A Ruby client library for [Redis][redis-home].

[redis-home]: http://redis.io

A Ruby client that tries to match Redis' API one-to-one, while still
providing an idiomatic interface. It features thread-safety, client-side
sharding, pipelining, and an obsession for performance.

## Upgrading from 2.x to 3.0

Please refer to the [CHANGELOG][changelog-3.0.0] for a summary of the
most important changes, as well as a full list of changes.

[changelog-3.0.0]: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md#300

## Getting started

To install **redis-rb**, run the following command:

```
gem install redis
```

Or if you are using **bundler**, add
Install with:

```
gem 'redis', '~>3.2'
$ gem install redis
```

to your `Gemfile`, and run `bundle install`

As of version 2.0 this client only targets Redis version 2.0 and higher.
You can use an older version of this client if you need to interface
with a Redis instance older than 2.0, but this is no longer supported.

You can connect to Redis by instantiating the `Redis` class:

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

```ruby
redis = Redis.new(:host => "10.0.1.1", :port => 6380, :db => 15)
redis = Redis.new(host: "10.0.1.1", port: 6380, db: 15)
```

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

```ruby
redis = Redis.new(:url => "redis://:[email protected]:6380/15")
redis = Redis.new(url: "redis://:[email protected]:6380/15")
```

[redis-url]: http://www.iana.org/assignments/uri-schemes/prov/redis

By default, the client will try to read the `REDIS_URL` environment variable
and use that as URL to connect to. The above statement is therefore equivalent
to setting this environment variable and calling `Redis.new` without arguments.

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

```ruby
redis = Redis.new(:path => "/tmp/redis.sock")
redis = Redis.new(path: "/tmp/redis.sock")
```

To connect to a password protected Redis instance, use:

```ruby
redis = Redis.new(:password => "mysecret")
redis = Redis.new(password: "mysecret")
```

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

[redis-commands]: http://redis.io/commands

```ruby
redis.set("mykey", "hello world")
# => "OK"
Expand All @@ -96,24 +63,22 @@ redis.get("mykey")
# => "hello world"
```

All commands, their arguments and return values are documented, and
available on [rdoc.info][rdoc].

[rdoc]: http://rdoc.info/github/redis/redis-rb/
All commands, their arguments, and return values are documented and
available on [RubyDoc.info][rubydoc].

## Sentinel support

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

To connect using Sentinel, use:

```ruby
SENTINELS = [{:host => "127.0.0.1", :port => 26380},
{:host => "127.0.0.1", :port => 26381}]
SENTINELS = [{ host: "127.0.0.1", port: 26380 },
{ host: "127.0.0.1", port: 26381 }]

redis = Redis.new(:url => "redis://mymaster", :sentinels => SENTINELS, :role => :master)
redis = Redis.new(url: "redis://mymaster", sentinels: SENTINELS, role: :master)
```

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

## Testing

This library is tested using [Travis][travis-home], where it is tested
against the following interpreters and drivers:

* MRI 1.8.7 (drivers: ruby, hiredis)
* MRI 1.9.3 (drivers: ruby, hiredis, synchrony)
* MRI 2.0 (drivers: ruby, hiredis, synchrony)
* MRI 2.1 (drivers: ruby, hiredis, synchrony)
* MRI 2.2 (drivers: ruby, hiredis, synchrony)
* MRI 2.3 (drivers: ruby, hiredis, synchrony)
* JRuby 1.7 (1.8 mode) (drivers: ruby)
* JRuby 1.7 (1.9 mode) (drivers: ruby)
This library is tested against recent Ruby and Redis versions.
Check [Travis][travis-link] for the exact versions supported.

## Contributors

(ordered chronologically with more than 5 commits, see `git shortlog -sn` for
all contributors)

* Ezra Zygmuntowicz
* Taylor Weibley
* Matthew Clark
* Brian McKinney
* Luca Guidi
* Salvatore Sanfilippo
* Chris Wanstrath
* Damian Janowski
* Michel Martens
* Nick Quaranto
* Pieter Noordhuis
* Ilya Grigorik
Several people contributed to redis-rb, but we would like to especially
mention Ezra Zygmuntowicz. Ezra introduced the Ruby community to many
new cool technologies, like Redis. He wrote the first version of this
client and evangelized Redis in Rubyland. Thank you, Ezra.

## Contributing

[Fork the project](https://github.com/redis/redis-rb) and send pull
requests. You can also ask for help at `#redis-rb` on Freenode.


[inchpages-image]: https://inch-ci.org/github/redis/redis-rb.svg
[inchpages-link]: https://inch-ci.org/github/redis/redis-rb
[redis-commands]: https://redis.io/commands
[redis-home]: https://redis.io
[redis-url]: http://www.iana.org/assignments/uri-schemes/prov/redis
[travis-home]: https://travis-ci.org/
[travis-image]: https://secure.travis-ci.org/redis/redis-rb.svg?branch=master
[travis-link]: https://travis-ci.org/redis/redis-rb
[rubydoc]: https://www.rubydoc.info/gems/redis
Loading