forked from mirror/redis
PoolStats is an alias for pool.Stats
This commit is contained in:
parent
aeb93fd3cb
commit
09176ef4fa
11
options.go
11
options.go
|
@ -198,14 +198,3 @@ func newConnPool(opt *Options) *pool.ConnPool {
|
||||||
IdleCheckFrequency: opt.IdleCheckFrequency,
|
IdleCheckFrequency: opt.IdleCheckFrequency,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// PoolStats contains pool state information and accumulated stats.
|
|
||||||
type PoolStats struct {
|
|
||||||
Requests uint32 // number of times a connection was requested by the pool
|
|
||||||
Hits uint32 // number of times free connection was found in the pool
|
|
||||||
Timeouts uint32 // number of times a wait timeout occurred
|
|
||||||
|
|
||||||
TotalConns uint32 // number of total connections in the pool
|
|
||||||
FreeConns uint32 // number of free connections in the pool
|
|
||||||
StaleConns uint32 // number of stale connections removed from the pool
|
|
||||||
}
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ var _ = Describe("pool", func() {
|
||||||
Timeouts: 0,
|
Timeouts: 0,
|
||||||
TotalConns: 1,
|
TotalConns: 1,
|
||||||
FreeConns: 1,
|
FreeConns: 1,
|
||||||
|
StaleConns: 0,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
|
@ -136,6 +137,7 @@ var _ = Describe("pool", func() {
|
||||||
Timeouts: 0,
|
Timeouts: 0,
|
||||||
TotalConns: 0,
|
TotalConns: 0,
|
||||||
FreeConns: 0,
|
FreeConns: 0,
|
||||||
|
StaleConns: 1,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
13
redis.go
13
redis.go
|
@ -352,17 +352,12 @@ func (c *Client) Options() *Options {
|
||||||
return c.opt
|
return c.opt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PoolStats pool.Stats
|
||||||
|
|
||||||
// PoolStats returns connection pool stats.
|
// PoolStats returns connection pool stats.
|
||||||
func (c *Client) PoolStats() *PoolStats {
|
func (c *Client) PoolStats() *PoolStats {
|
||||||
s := c.connPool.Stats()
|
stats := c.connPool.Stats()
|
||||||
return &PoolStats{
|
return (*PoolStats)(stats)
|
||||||
Requests: s.Requests,
|
|
||||||
Hits: s.Hits,
|
|
||||||
Timeouts: s.Timeouts,
|
|
||||||
|
|
||||||
TotalConns: s.TotalConns,
|
|
||||||
FreeConns: s.FreeConns,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) {
|
func (c *Client) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) {
|
||||||
|
|
Loading…
Reference in New Issue