INNER CODE UNIT · Go
New
go-graphite/go-carbon · api/api.go:30
func New(c *cache.Cache) *Api {
return &Api{
cache: c,
}
}
// Addr returns binded socket address. For bind port 0 in tests
func (api *Api) Addr() net.Addr {
if api.listener == nil {
return nil
}
return api.listener.Addr()
}
// Collect cache metrics
func (api *Api) Stat(send helper.StatCallback) {
helper.SendAndSubstractUint32("cacheRequests", &api.stat.cacheRequests, send)
helper.SendAndSubstractUint32("cacheRequestMetrics", &api.stat.cacheRequestMetrics, send)