redis 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  require 'socket'
2
2
 
3
3
  class Redis
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
 
6
6
  class ProtocolError < RuntimeError
7
7
  def initialize(reply_type)
@@ -94,7 +94,7 @@ class Redis
94
94
  end
95
95
 
96
96
  def keys(pattern = "*")
97
- @client.call(:keys, pattern)
97
+ _array @client.call(:keys, pattern)
98
98
  end
99
99
 
100
100
  def randomkey
@@ -462,6 +462,14 @@ class Redis
462
462
  @client = original
463
463
  end
464
464
 
465
+ def watch(*keys)
466
+ @client.call(:watch, *keys)
467
+ end
468
+
469
+ def unwatch
470
+ @client.call(:unwatch)
471
+ end
472
+
465
473
  def exec
466
474
  @client.call(:exec)
467
475
  end
@@ -557,6 +565,10 @@ private
557
565
  value == 1
558
566
  end
559
567
 
568
+ def _array(value)
569
+ value.kind_of?(Array) ? value : value.split(" ")
570
+ end
571
+
560
572
  def subscription(method, channels, block)
561
573
  return @client.call(method, *channels) if subscribed?
562
574
 
@@ -188,8 +188,11 @@ class Redis
188
188
  end
189
189
 
190
190
  def format_multi_bulk_reply(line)
191
+ n = line.to_i
192
+ return if n == -1
193
+
191
194
  reply = []
192
- line.to_i.times { reply << read }
195
+ n.times { reply << read }
193
196
  reply
194
197
  end
195
198
 
@@ -418,6 +418,14 @@ class Redis
418
418
  raise CannotDistribute, :multi
419
419
  end
420
420
 
421
+ def watch(*keys)
422
+ raise CannotDistribute, :watch
423
+ end
424
+
425
+ def unwatch
426
+ raise CannotDistribute, :unwatch
427
+ end
428
+
421
429
  def exec
422
430
  raise CannotDistribute, :exec
423
431
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 0
10
- version: 2.0.0
9
+ - 1
10
+ version: 2.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ezra Zygmuntowicz
@@ -22,7 +22,7 @@ autorequire: redis
22
22
  bindir: bin
23
23
  cert_chain: []
24
24
 
25
- date: 2010-05-14 00:00:00 -03:00
25
+ date: 2010-05-29 00:00:00 -03:00
26
26
  default_executable:
27
27
  dependencies: []
28
28