You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/05/14 22:37:32 UTC

[GitHub] rob05c commented on a change in pull request #2246: Add HitCount and FreshFor

rob05c commented on a change in pull request #2246: Add HitCount and FreshFor
URL: https://github.com/apache/incubator-trafficcontrol/pull/2246#discussion_r188119204
 
 

 ##########
 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:
   I don't think you're allowed to have more symbols than letters on a line, when it's not Perl.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services