eventmachine-redis 0.1.0 → 0.1.1
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.
- data/VERSION +1 -1
- data/eventmachine-redis.gemspec +1 -1
- data/lib/eventmachine-redis.rb +5 -1
- data/spec/redis_spec.rb +8 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/eventmachine-redis.gemspec
CHANGED
data/lib/eventmachine-redis.rb
CHANGED
@@ -9,7 +9,7 @@ module EventMachine::Protocols::Redis
|
|
9
9
|
TYPE_INTEGER = ':'.freeze
|
10
10
|
TYPE_MULTIPLE = '*'.freeze
|
11
11
|
|
12
|
-
MULTILINE_COMMANDS = %w().freeze
|
12
|
+
MULTILINE_COMMANDS = %w(RPUSH).freeze
|
13
13
|
|
14
14
|
def self.connect(host = 'localhost', port = 6379)
|
15
15
|
EM.connect(host, port, self)
|
@@ -41,6 +41,10 @@ module EventMachine::Protocols::Redis
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
def push(key, value, &block)
|
45
|
+
command('RPUSH', key, value, &block)
|
46
|
+
end
|
47
|
+
|
44
48
|
def shift(key, options = {}, &block)
|
45
49
|
if options[:timeout]
|
46
50
|
command('BLPOP', key, options[:timeout], &block)
|
data/spec/redis_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe EventMachine::Protocols::Redis do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should define multiline commands constant' do
|
28
|
-
Redis::MULTILINE_COMMANDS.should == %w()
|
28
|
+
Redis::MULTILINE_COMMANDS.should == %w(RPUSH)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should connect via EventMachine when calling Redis.connect' do
|
@@ -88,6 +88,13 @@ describe EventMachine::Protocols::Redis do
|
|
88
88
|
@completed.should be_true
|
89
89
|
end
|
90
90
|
|
91
|
+
describe '#push' do
|
92
|
+
it 'should generate RPUSH command' do
|
93
|
+
@instance.push('key', 'value')
|
94
|
+
@instance.sent_data.should == "RPUSH key 5\r\nvalue\r\n"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
91
98
|
describe '#shift' do
|
92
99
|
it 'should generate LPOP command' do
|
93
100
|
@instance.shift('key')
|