ing
This commit is contained in:
parent
497fde3617
commit
8e07c95b56
|
@ -1,12 +1,12 @@
|
||||||
package redis_pool
|
package redis_pool
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Maximum number of idle connections in the pool.
|
|
||||||
DefaultMaxIdle = 1
|
|
||||||
|
|
||||||
// Maximum number of connections allocated by the pool at a given time.
|
// Maximum number of connections allocated by the pool at a given time.
|
||||||
// When zero, there is no limit on the number of connections in the pool.
|
// When zero, there is no limit on the number of connections in the pool.
|
||||||
DefaultMaxActive = 1
|
DefaultMaxCapacity = 1
|
||||||
|
|
||||||
|
// Maximum number of idle connections in the pool.
|
||||||
|
DefaultMaxIdle = 1
|
||||||
|
|
||||||
// Close connections after remaining idle for this duration. If the value
|
// Close connections after remaining idle for this duration. If the value
|
||||||
// is zero, then idle connections are not closed. Applications should set
|
// is zero, then idle connections are not closed. Applications should set
|
||||||
|
|
|
@ -47,12 +47,12 @@ func (ph *PoolHandlers) IsWait() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ph *PoolHandlers) Validate() {
|
func (ph *PoolHandlers) Validate() {
|
||||||
|
if ph.MaxCapacity <= 0 {
|
||||||
|
ph.MaxCapacity = DefaultMaxCapacity
|
||||||
|
}
|
||||||
if ph.MaxIdle <= 0 {
|
if ph.MaxIdle <= 0 {
|
||||||
ph.MaxIdle = DefaultMaxIdle
|
ph.MaxIdle = DefaultMaxIdle
|
||||||
}
|
}
|
||||||
if ph.MaxActive <= 0 {
|
|
||||||
ph.MaxActive = DefaultMaxActive
|
|
||||||
}
|
|
||||||
if ph.IdleTimeout <= 0 {
|
if ph.IdleTimeout <= 0 {
|
||||||
ph.IdleTimeout = DefaultIdleTimeout
|
ph.IdleTimeout = DefaultIdleTimeout
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user