mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Make free-connection stack a LIFO.
This commit is contained in:
committed by
Vladimir Mihailenco
parent
7a4f8ede8f
commit
1bb55e3a9a
@ -35,6 +35,10 @@ func NewConn(netConn net.Conn) *Conn {
|
||||
return cn
|
||||
}
|
||||
|
||||
func (cn *Conn) IsStale(timeout time.Duration) bool {
|
||||
return timeout > 0 && time.Since(cn.UsedAt) > timeout
|
||||
}
|
||||
|
||||
func (cn *Conn) SetNetConn(netConn net.Conn) {
|
||||
cn.netConn = netConn
|
||||
cn.UsedAt = time.Now()
|
||||
|
Reference in New Issue
Block a user