2013-11-07 18:20:15 +04:00
|
|
|
package redis
|
|
|
|
|
2016-03-04 11:03:50 +03:00
|
|
|
import (
|
|
|
|
"net"
|
2016-03-09 13:49:21 +03:00
|
|
|
"sync"
|
2016-03-04 11:03:50 +03:00
|
|
|
"time"
|
|
|
|
)
|
2015-05-10 15:33:04 +03:00
|
|
|
|
2013-11-07 18:20:15 +04:00
|
|
|
func (c *baseClient) Pool() pool {
|
|
|
|
return c.connPool
|
|
|
|
}
|
2015-03-23 11:23:33 +03:00
|
|
|
|
2016-03-01 13:31:06 +03:00
|
|
|
func (c *PubSub) Pool() pool {
|
|
|
|
return c.base.connPool
|
|
|
|
}
|
|
|
|
|
2015-10-13 12:02:29 +03:00
|
|
|
var NewConnDialer = newConnDialer
|
|
|
|
|
2015-05-10 15:33:04 +03:00
|
|
|
func (cn *conn) SetNetConn(netcn net.Conn) {
|
|
|
|
cn.netcn = netcn
|
|
|
|
}
|
2016-03-04 11:03:50 +03:00
|
|
|
|
2016-03-09 13:49:21 +03:00
|
|
|
var timeMu sync.Mutex
|
|
|
|
|
2016-03-04 11:03:50 +03:00
|
|
|
func SetTime(tm time.Time) {
|
2016-03-09 13:49:21 +03:00
|
|
|
timeMu.Lock()
|
2016-03-04 11:03:50 +03:00
|
|
|
now = func() time.Time {
|
|
|
|
return tm
|
|
|
|
}
|
2016-03-09 13:49:21 +03:00
|
|
|
timeMu.Unlock()
|
2016-03-04 11:03:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func RestoreTime() {
|
2016-03-09 13:49:21 +03:00
|
|
|
timeMu.Lock()
|
2016-03-04 11:03:50 +03:00
|
|
|
now = time.Now
|
2016-03-09 13:49:21 +03:00
|
|
|
timeMu.Unlock()
|
2016-03-04 11:03:50 +03:00
|
|
|
}
|