50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
|
package overflow_redis_pool
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/garyburd/redigo/redis"
|
||
|
)
|
||
|
|
||
|
type PoolHandlers struct {
|
||
|
// Maximum number of idle connections in the pool.
|
||
|
MaxIdle int
|
||
|
|
||
|
// 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.
|
||
|
MaxActive int
|
||
|
|
||
|
// Close connections after remaining idle for this duration. If the value
|
||
|
// is zero, then idle connections are not closed. Applications should set
|
||
|
// the timeout to a value less than the server's timeout.
|
||
|
IdleTimeout time.Duration
|
||
|
|
||
|
// If Wait is true and the pool is at the MaxActive limit, then Get() waits
|
||
|
// for a connection to be returned to the pool before returning.
|
||
|
Wait bool
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) Dial() (redis.Conn, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) TestOnBorrow(c redis.Conn, t time.Time) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) GetMaxIdle() int {
|
||
|
return h.MaxIdle
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) GetMaxActive() int {
|
||
|
return h.MaxActive
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) GetIdleTimeout() time.Duration {
|
||
|
return h.IdleTimeout
|
||
|
}
|
||
|
|
||
|
func (h *PoolHandlers) IsWait() bool {
|
||
|
return h.Wait
|
||
|
}
|