Skip to content

Commit

Permalink
Merge pull request resque#20 from abozanich/master
Browse files Browse the repository at this point in the history
HSETNX support
  • Loading branch information
defunkt committed May 16, 2011
2 parents ecd8a2a + e5b550d commit d45c762
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/redis/namespace.rb
Expand Up @@ -56,6 +56,7 @@ class Namespace
"get" => [ :first ],
"getset" => [ :first ],
"hset" => [ :first ],
"hsetnx" => [ :first ],
"hget" => [ :first ],
"hincrby" => [ :first ],
"hmget" => [ :first ],
Expand Down
6 changes: 6 additions & 0 deletions spec/redis_spec.rb
Expand Up @@ -79,6 +79,12 @@
@namespaced.hincrby('bar', 'a_number', 3)
@namespaced.hmget('bar', 'a_number').should == ['4']
@namespaced.hgetall('bar').should == {'key' => 'value', 'key1' => 'value1', 'a_number' => '4'}

@namespaced.hsetnx('foonx','nx',10).should be_true
@namespaced.hsetnx('foonx','nx',12).should be_false
@namespaced.hget('foonx','nx').should == "10"
@namespaced.hkeys('foonx').should == %w{ nx }
@namespaced.hvals('foonx').should == %w{ 10 }
end

it "should properly intersect three sets" do
Expand Down

0 comments on commit d45c762

Please sign in to comment.