knutsel commented on a change in pull request #2246: Add HitCount and FreshFor
URL:
https://github.com/apache/incubator-trafficcontrol/pull/2246#discussion_r188635843
##########
File path: grove/plugin/http_cacheinspector.go
##########
@@ -169,16 +170,17 @@ func cacheinspect(icfg interface{}, d OnRequestData)
bool {
w.Write([]byte(fmt.Sprintf("showing only first
%d and last %d:\n\n", head, tail)))
}
- w.Write([]byte(fmt.Sprintf("<b>
#\t\tCode\tSize\tAge\t\t\tKey</b>\n")))
+ w.Write([]byte(fmt.Sprintf("<b> # Code
Size Age FreshFor HitCount
Key</b>\n")))
for i, key := range keys {
- if (doSearch && !strings.Contains(key,
searchArr[0])) || !doSearch && (i > tail && i < len(keys)-head) {
+ if (doSearch && !strings.Contains(key,
searchArr[0])) || !doSearch && (i >= tail && i < len(keys)-head) {
continue
}
cacheObject, _ := d.Stats.CachePeek(key, cName)
age := time.Now().Sub(cacheObject.ReqRespTime)
- w.Write([]byte(fmt.Sprintf("
%05d\t%d\t%s\t%-20v\t<a href=\"http://%s%s?key=%s&cache=%s\">%s</a>\n",
- i, cacheObject.Code,
bytefmt.ByteSize(cacheObject.Size), age, req.Host, CacheStatsEndpoint,
url.QueryEscape(key), cName, key)))
+ freshFor :=
web.FreshFor(cacheObject.RespHeaders, cacheObject.RespCacheControl,
cacheObject.ReqRespTime, cacheObject.RespRespTime)
+ w.Write([]byte(fmt.Sprintf("
%8d%8d%10s%22v%22v%12d <a href=\"http://%s%s?key=%s&cache=%s\">%s</a>\n",
Review comment:
It compiles, and works, so I'm going with it ;-)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services