redis 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/lib/redis.rb +4 -2
- data/lib/redis/pipeline.rb +8 -0
- data/lib/redis/version.rb +1 -1
- data/test/pipelining_commands_test.rb +12 -0
- data/test/sorting_test.rb +14 -0
- data/test/transactions_test.rb +6 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/lib/redis.rb
CHANGED
@@ -524,7 +524,7 @@ class Redis
|
|
524
524
|
|
525
525
|
synchronize do |client|
|
526
526
|
client.call([:sort, key] + args) do |reply|
|
527
|
-
if get.size > 1
|
527
|
+
if get.size > 1 && !store
|
528
528
|
if reply
|
529
529
|
reply.each_slice(get.size).to_a
|
530
530
|
end
|
@@ -1994,7 +1994,7 @@ class Redis
|
|
1994
1994
|
# @see #multi
|
1995
1995
|
def watch(*keys)
|
1996
1996
|
synchronize do |client|
|
1997
|
-
client.call([:watch] + keys)
|
1997
|
+
res = client.call([:watch] + keys)
|
1998
1998
|
|
1999
1999
|
if block_given?
|
2000
2000
|
begin
|
@@ -2005,6 +2005,8 @@ class Redis
|
|
2005
2005
|
unwatch
|
2006
2006
|
raise
|
2007
2007
|
end
|
2008
|
+
else
|
2009
|
+
res
|
2008
2010
|
end
|
2009
2011
|
end
|
2010
2012
|
end
|
data/lib/redis/pipeline.rb
CHANGED
data/lib/redis/version.rb
CHANGED
@@ -132,6 +132,18 @@ class TestPipeliningCommands < Test::Unit::TestCase
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
def test_futures_can_be_identified
|
136
|
+
r.pipelined do
|
137
|
+
@result = r.sadd("foo", 1)
|
138
|
+
end
|
139
|
+
|
140
|
+
assert_equal true, @result.is_a?(Redis::Future)
|
141
|
+
if defined?(::BasicObject)
|
142
|
+
assert_equal true, @result.is_a?(::BasicObject)
|
143
|
+
end
|
144
|
+
assert_equal Redis::Future, @result.class
|
145
|
+
end
|
146
|
+
|
135
147
|
def test_returning_the_result_of_an_empty_pipeline
|
136
148
|
result = r.pipelined do
|
137
149
|
end
|
data/test/sorting_test.rb
CHANGED
@@ -42,4 +42,18 @@ class TestSorting < Test::Unit::TestCase
|
|
42
42
|
r.sort("bar", :get => "foo:*", :store => "baz")
|
43
43
|
assert_equal ["s1", "s2"], r.lrange("baz", 0, -1)
|
44
44
|
end
|
45
|
+
|
46
|
+
def test_sort_with_an_array_of_gets_and_with_store
|
47
|
+
r.set("foo:1:a", "s1a")
|
48
|
+
r.set("foo:1:b", "s1b")
|
49
|
+
|
50
|
+
r.set("foo:2:a", "s2a")
|
51
|
+
r.set("foo:2:b", "s2b")
|
52
|
+
|
53
|
+
r.rpush("bar", "1")
|
54
|
+
r.rpush("bar", "2")
|
55
|
+
|
56
|
+
r.sort("bar", :get => ["foo:*:a", "foo:*:b"], :store => 'baz')
|
57
|
+
assert_equal ["s1a", "s1b", "s2a", "s2b"], r.lrange("baz", 0, -1)
|
58
|
+
end
|
45
59
|
end
|
data/test/transactions_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2013-
|
20
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rake
|