README.md in redic-0.0.8 vs README.md in redic-1.0.0
- old
+ new
@@ -19,14 +19,47 @@
redis.call("SET", "foo", "bar")
assert_equal "bar", redis.call("GET", "foo")
# Pipelining is implemented by buffering commands,
-# then calling Redic#run
+# then calling Redic#commit
redis.queue("SET", "foo", "bar")
redis.queue("GET", "foo")
assert_equal ["OK", "bar"], redis.commit
+```
+
+You can provide the password and the database to be selected. The
+format for Redis URLs is `redis://user:pass@host:port/db`. As
+Redis only needs a password for authentication, the user can be
+omitted:
+
+```ruby
+# Connect to localhost:6380 using "bar" as password and use the
+# database 2. Both AUTH and SELECT commands are issued after
+# connecting. The user part of the URL is not provided.
+redis = Redic.new("redis://:bar@localhost:6380/2")
+```
+
+It is also possible to configure a timeout for the connection. The
+default timeout is 10 seconds.
+
+```ruby
+# Timeout expressed in microseconds.
+redis = Redic.new(timeout: 2_000_000)
+redis.timeout == 2_000_000 #=> true
+```
+
+Here's one final example using both a Redis URL and a timeout:
+
+```ruby
+# It's recommended to store the REDIS_URL as an environment
+# variable. Use `fetch` to retrieve values that must be present,
+# as it raises an error if the value is not found.
+REDIS_URL = ENV.fetch("REDIS_URL")
+REDIS_TIMEOUT = ENV.fetch("REDIS_TIMEOUT")
+
+redis = Redic.new(REDIS_URL, timeout: REDIS_TIMEOUT)
```
## Differences with redis-rb
Redic uses [hiredis][hiredis] for the connection and for parsing