lib/rack/insight/views/panels/cache.html.erb
<h3>Cache Usage</h3>
<table id="cache_usage">
<colgroup>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
<col width="12%"/>
</colgroup>
<tr>
<th>Total Calls</th>
<td><%= stats.calls %></td>
<th>Total Time</th>
<td><%= stats.display_time %></td>
<th>Hits</th>
<td><%= stats.hits %></td>
<th>Misses</th>
<td><%= stats.misses %></td>
</tr>
<tr>
<th>gets</th>
<td><%= stats.gets %></td>
<th>sets</th>
<td><%= stats.sets %></td>
<th>deletes</th>
<td><%= stats.deletes %></td>
<th>get_multis</th>
<td><%= stats.get_multis %></td>
</tr>
</table>
<% if stats.queries.any? %>
<h3>Breakdown</h3>
<table id="cache_breakdown" class="sortable">
<thead>
<tr>
<th>Time (ms)</th>
<th>Type</th>
<th>Parameters</th>
<th>Function</th>
<th>
<a href="/__insight__/delete_cache_list?<%= signed_params(stats.queries_to_param) %>" class="rack-insight_delete_cache">
Delete All
</a>
</th>
</tr>
</thead>
<tbody>
<% i = 1 %>
<% stats.queries.each do |query| %>
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
<td><%= query.display_time %></td>
<td><%= query.method %></td>
<td><%= query.display_keys %></td>
<td></td>
<td>
<a href="/__insight__/view_cache?<%= signed_params("key" => query.keys.first) %>" class="remote_call">View</a> |
<a href="/__insight__/delete_cache?<%= signed_params("key" => query.keys.first) %>" class="rack-insight_delete_cache">Delete</a>
</td>
</tr>
<% i += 1 %>
<% end %>
</tbody>
</table>
<% end %>
<script type="text/javascript" charset="utf-8">
jQuery(function () {
jQuery("#rack-insight .rack-insight_delete_cache").click(function (evt) {
jQuery.ajax({
url: this.href,
beforeSend: function() {
jQuery(evt.target).parent("td, th").addClass("rack-insight_spinner");
},
success: function () {
jQuery(evt.target).parent("td, th").removeClass("rack-insight_spinner");
jQuery(evt.target).replaceWith("Deleted");
}
});
return false;
});
});
</script>