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-
4415You 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
5425server 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
6031You 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-
6837By default, the client will try to read the ` REDIS_URL ` environment variable
6938and use that as URL to connect to. The above statement is therefore equivalent
7039to setting this environment variable and calling ` Redis.new ` without arguments.
7140
7241To 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
7847To 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
8453The Redis class exports methods that are named identical to the commands
8554they execute. The arguments these methods accept are often identical to
8655the arguments specified on the [ Redis website] [ redis-commands ] . For
8756instance, the ` SET ` and ` GET ` commands can be called like this:
8857
89- [ redis-commands ] : http://redis.io/commands
90-
9158``` ruby
9259redis.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
10772Sentinel] ( http://redis.io/topics/sentinel ) . Make sure to run Redis 2.8+
10873if you want to use this feature.
10974
11075To 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
410355requests. 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