Skip to content

Commit

Permalink
more error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Belo committed Mar 26, 2012
1 parent 6c42a71 commit d8559e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/redis-store-rails2.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ def delete(key, options={})
super super
response = @store.del(key) response = @store.del(key)
response >= 0 response >= 0
rescue Errno::ECONNREFUSED => e
false
end end


def increment(key, amount = 1) def increment(key, amount = 1)
return nil unless @store.exists(key) return nil unless @store.exists(key)
@store.incrby key, amount @store.incrby key, amount
rescue Errno::ECONNREFUSED => e
nil
end end


def decrement(key, amount = 1) def decrement(key, amount = 1)
return nil unless @store.exists(key) return nil unless @store.exists(key)
@data.decrby key, amount @data.decrby key, amount
rescue Errno::ECONNREFUSED => e
nil
end end


def clear def clear
Expand Down

0 comments on commit d8559e8

Please sign in to comment.