Skip to content

Commit

Permalink
Merge pull request #4 from gierschv/master
Browse files Browse the repository at this point in the history
Fix division by zero in stats command when there is no hit
  • Loading branch information
beryllium committed May 23, 2012
2 parents 62488ba + a911067 commit 9c66cf8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Command/CacheClientStatsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public function formatStats( $stats, $debug = false )
$out .= "\tOpen Connections: " . $item[ 'curr_connections' ] . "\n";
$out .= "\tHits: " . $item[ 'get_hits' ] . "\n";
$out .= "\tMisses: " . $item[ 'get_misses' ] . "\n";
$out .= "\tHelpfulness: " . round( $item[ 'get_hits' ] / ( $item[ 'get_hits' ] + $item[ 'get_misses' ] ) * 100, 2 ) . "%\n";
if ( $item[ 'get_hits' ] + $item[ 'get_misses' ] > 0 )
$out .= "\tHelpfulness: " . round( $item[ 'get_hits' ] / ( $item[ 'get_hits' ] + $item[ 'get_misses' ] ) * 100, 2 ) . "%\n";

if ( $debug )
{
Expand Down

0 comments on commit 9c66cf8

Please sign in to comment.