測試方式
go run groupcache.go -http=:8081 -groupcache-peers=:8082,:8083
go run groupcache.go -http=:8082 -groupcache-peers=:8081,:8083
go run groupcache.go -http=:8083 -groupcache-peers=:8081,:8082
開啟你的本地瀏覽器 http://localhost:8081/medium.jpg?width=100
這邊是可以看到你目前的狀態 http://localhost:8081/stats
你可以看到以下的資訊
{
"Group": {
"Gets": 2,
"CacheHits": 1,
"PeerLoads": 0,
"PeerErrors": 1,
"Loads": 1,
"LoadsDeduped": 1,
"LocalLoads": 1,
"LocalLoadErrs": 0,
"ServerRequests": 0
},
"Caches": {
"Main": {
"Bytes": 2762,
"Items": 1,
"Gets": 3,
"Hits": 1,
"Evictions": 0
},
"Hot": {
"Bytes": 0,
"Items": 0,
"Gets": 2,
"Hits": 0,
"Evictions": 0
}
}
}
閱讀更多