redis_pipeliner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -24,9 +24,9 @@ redis.hest "h3", "baz", 3
24
24
  # Get the values pipelined and sum them up
25
25
  values = RedisPipeliner.pipeline redis do |p|
26
26
  # This would normally be 3 round-trips
27
- p.enqueue redis.hget("h1", "foo")
28
- p.enqueue redis.hget("h2", "bar")
29
- p.enqueue redis.hget("h3", "baz")
27
+ p << redis.hget("h1", "foo")
28
+ p << redis.hget("h2", "bar")
29
+ p << redis.hget("h3", "baz")
30
30
  end
31
31
  values.map(&:to_i).inject(&:+).should == 6
32
32
  ```
@@ -37,7 +37,7 @@ You can also pass in a block to be called for each value rather than operating o
37
37
  results = []
38
38
  RedisPipeliner.pipeline redis do |p|
39
39
  [%w(h1 foo), %w(h2 bar), %w(h3 baz)].each do |pair|
40
- p.enqueue redis.hget(pair[0], pair[1]) do |value|
40
+ p << redis.hget(pair[0], pair[1]) do |value|
41
41
  # referencing pair inside the block
42
42
  results << pair[1] + value
43
43
  end
@@ -12,6 +12,7 @@ module RedisPipeliner
12
12
  def enqueue(future, &proc)
13
13
  @commands << { future: future, callback: proc }
14
14
  end
15
+ alias_method :<<, :enqueue
15
16
 
16
17
  # Blocks until all Futures have been realized and returns the values.
17
18
  # This should be called _outside_ the Redis.pipelined call.
@@ -1,3 +1,3 @@
1
1
  module RedisPipeliner
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -15,7 +15,7 @@ describe RedisPipeliner do
15
15
  total = 0
16
16
  values = RedisPipeliner.pipeline redis do |pipe|
17
17
  %w(bar foo).each do |key|
18
- pipe.enqueue redis.hget("testhash", key) do |result|
18
+ pipe << redis.hget("testhash", key) do |result|
19
19
  total += result.to_i
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_pipeliner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-05 00:00:00.000000000 Z
12
+ date: 2013-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis