Skip to content

Commit

Permalink
Clean up reset_stats, petergoldstein#155
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Feb 26, 2012
1 parent ce06b01 commit 26a17ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 5 additions & 1 deletion History.md
Expand Up @@ -7,14 +7,18 @@ pick up 2.x releases:

gem 'dalli', '~> 1.1'

HEAD
=======

- Added reset\_stats operation [#155]

1.1.5
=======

- Coerce input to incr/decr to integer via #to\_i [#165]
- Convert test suite to minitest/spec (crigor, #166)
- Fix encoding issue with keys [#162]
- Fix double namespacing with Rails and dalli\_store. [#160]
- Added reset\_stats operation [#155]

1.1.4
=======
Expand Down
2 changes: 1 addition & 1 deletion lib/dalli/client.rb
Expand Up @@ -232,7 +232,7 @@ def stats
##
# Reset stats for each server.
def reset_stats
ring.servers.each do |server|
ring.servers.map do |server|
server.alive? ? server.request(:reset_stats) : nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dalli/version.rb
@@ -1,3 +1,3 @@
module Dalli
VERSION = '1.1.5'
VERSION = '1.1.6'
end
15 changes: 7 additions & 8 deletions test/test_dalli.rb
Expand Up @@ -105,19 +105,18 @@

should "support stats" do
memcached do |dc|
stats = dc.stats
# make sure that get_hits would not equal 0
dc.get(:a)
dc.get(:a)

assert stats.is_a?(Hash)
stats = dc.stats
servers = stats.keys

servers.each do |s|
assert_operator 0, :<, stats[s]["get_hits"].to_i
end
assert(servers.any? do |s|
stats[s]["get_hits"].to_i != 0
end)

# reset_stats test
dc.reset_stats
results = dc.reset_stats
assert(results.all? { |x| x })
stats = dc.stats
servers = stats.keys

Expand Down

0 comments on commit 26a17ec

Please sign in to comment.