Skip to content

Commit

Permalink
Ensure that stored false values are returned as false rather than nil
Browse files Browse the repository at this point in the history
  • Loading branch information
laserlemon committed Apr 11, 2012
1 parent 020c2e5 commit 5efba9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dalli/client.rb
Expand Up @@ -46,7 +46,7 @@ def multi

def get(key, options=nil)
resp = perform(:get, key)
(!resp || resp == 'Not found') ? nil : resp
resp.nil? || resp == 'Not found' ? nil : resp
end

##
Expand Down
6 changes: 6 additions & 0 deletions test/test_dalli.rb
Expand Up @@ -330,6 +330,12 @@
resp = dc.get('456', :raw => true)
assert_equal '0xyz9', resp

resp = dc.set('456', false)
assert_equal true, resp

resp = dc.get('456')
assert_equal false, resp

resp = dc.stats
assert_equal Hash, resp.class

Expand Down

0 comments on commit 5efba9f

Please sign in to comment.