redic 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +16 -0
- data/README.md +9 -0
- data/lib/redic.rb +4 -2
- data/redic.gemspec +1 -1
- data/tests/multithreaded_test.rb +9 -1
- data/tests/redic_test.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b87eca346ba119f79fe0fe1d10d2fddb6496aa8
|
4
|
+
data.tar.gz: 0fbf48927126da0626d0e5c7a5b088d2e30e50d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a50d44772e1fb5ae12967fc1bead5b23e01d7c466ab448e7770576e7ac588f2d5eb42f9708d2baa19322bf9e76d0986f79dcb61ef529124a35ca4c0606b37565
|
7
|
+
data.tar.gz: d0a00c6821040e8f67441e624b3da6672691d46fbd6abbf1f13f25b7a0510bc09fc9cdc5122482970bc0f60b726c3981701209477b51bcc47f4466c79d62cd55
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
1.4.1
|
2
|
+
|
3
|
+
- Reconnect only if URLs differ.
|
4
|
+
|
5
|
+
1.4.0
|
6
|
+
|
7
|
+
- Close connections with Redic#quit.
|
8
|
+
|
9
|
+
1.3.0
|
10
|
+
|
11
|
+
- Improve support for multithreaded environments.
|
12
|
+
|
13
|
+
1.2.0
|
14
|
+
|
15
|
+
- Add Redic#configure.
|
16
|
+
|
1
17
|
1.1.1
|
2
18
|
|
3
19
|
- Redic can now connect to sentinels.
|
data/README.md
CHANGED
@@ -71,6 +71,15 @@ redis = Redic.new(REDIS_URL, REDIS_TIMEOUT)
|
|
71
71
|
Both the initializer and the `configure` method accept a `URL` and
|
72
72
|
a `timeout`.
|
73
73
|
|
74
|
+
In order to close the connection, call `quit`:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
redis = Redic.new("redis://localhost:6379")
|
78
|
+
redis.quit
|
79
|
+
```
|
80
|
+
|
81
|
+
With that command, `"QUIT"` is sent to Redis and the socket is closed.
|
82
|
+
|
74
83
|
## Differences with redis-rb
|
75
84
|
|
76
85
|
Redic uses [hiredis][hiredis] for the connection and for parsing
|
data/lib/redic.rb
CHANGED
data/redic.gemspec
CHANGED
data/tests/multithreaded_test.rb
CHANGED
@@ -4,7 +4,15 @@ require_relative "../lib/redic"
|
|
4
4
|
REDIS_URL = "redis://localhost:6379/"
|
5
5
|
|
6
6
|
prepare do
|
7
|
-
Redic.new(REDIS_URL)
|
7
|
+
c = Redic.new(REDIS_URL)
|
8
|
+
|
9
|
+
begin
|
10
|
+
c.call("FLUSHDB")
|
11
|
+
rescue
|
12
|
+
c.call("AUTH", "foo")
|
13
|
+
c.call("FLUSHDB")
|
14
|
+
c.call("CONFIG", "SET", "requirepass", "")
|
15
|
+
end
|
8
16
|
end
|
9
17
|
|
10
18
|
test "multiple threads" do
|
data/tests/redic_test.rb
CHANGED
@@ -5,6 +5,7 @@ REDIS_URL = "redis://localhost:6379/"
|
|
5
5
|
|
6
6
|
prepare do
|
7
7
|
c = Redic.new(REDIS_URL)
|
8
|
+
|
8
9
|
begin
|
9
10
|
c.call("FLUSHDB")
|
10
11
|
rescue
|
@@ -187,9 +188,22 @@ test "pub/sub" do |c1|
|
|
187
188
|
end
|
188
189
|
|
189
190
|
test "reconnect" do |c1|
|
191
|
+
url = "redis://:foo@localhost:6379/"
|
192
|
+
|
193
|
+
assert url != c1.url
|
194
|
+
|
190
195
|
c1.call("CONFIG", "SET", "requirepass", "foo")
|
191
196
|
|
192
|
-
c1.configure(
|
197
|
+
c1.configure(url)
|
198
|
+
|
199
|
+
assert url == c1.url
|
200
|
+
assert url.object_id == c1.url.object_id
|
201
|
+
|
202
|
+
# Reconfigure only if URLs differ
|
203
|
+
c1.configure(url.dup)
|
204
|
+
|
205
|
+
# No reconnection ocurred
|
206
|
+
assert url.object_id == c1.url.object_id
|
193
207
|
|
194
208
|
assert_equal "PONG", c1.call("PING")
|
195
209
|
end
|