redis 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  # 3.0.4 (unreleased)
2
2
 
3
- * ...
3
+ * Ensure #watch without a block returns "OK" (#332).
4
+
5
+ * Make futures identifiable (#330).
6
+
7
+ * Fix an issue preventing STORE in a SORT with multiple GETs (#328).
4
8
 
5
9
  # 3.0.3
6
10
 
@@ -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
@@ -126,5 +126,13 @@ class Redis
126
126
  ::Kernel.raise(@object) if @object.kind_of?(::RuntimeError)
127
127
  @object
128
128
  end
129
+
130
+ def is_a?(other)
131
+ self.class.ancestors.include?(other)
132
+ end
133
+
134
+ def class
135
+ Future
136
+ end
129
137
  end
130
138
  end
@@ -1,3 +1,3 @@
1
1
  class Redis
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
@@ -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
@@ -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
@@ -157,6 +157,12 @@ class TestTransactions < Test::Unit::TestCase
157
157
  end
158
158
  end
159
159
 
160
+ def test_watch
161
+ res = r.watch "foo"
162
+
163
+ assert_equal "OK", res
164
+ end
165
+
160
166
  def test_watch_with_an_unmodified_key
161
167
  r.watch "foo"
162
168
  r.multi do |multi|
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.3
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-03-01 00:00:00.000000000 Z
20
+ date: 2013-04-23 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rake