"sync" "time" ) // 版本号,每次更新都需要增加 const VERSION = "1.0.72" const PREFIX = "__goredis:" var ( WrongKindError = errors.New("Wrong kind opration") WrongKindReply = ErrorReply(WrongKindError) ) var ( slowexec = float64(30) // ms slowlog = stdlog.Log("slow") ) // GoRedisServer type GoRedisServer struct { ServerHandler RedisServer // 数据源 opt *Options // 选项 levelRedis *levelredis.LevelRedis config *Config // counters counters *counter.Counters cmdCounters *counter.Counters cmdCateCounters *counter.Counters // 指令集统计 execCounters *counter.Counters //指令执行时间计数器
import ( . "GoRedis/goredis" "GoRedis/libs/counter" "GoRedis/libs/iotool" "GoRedis/libs/rdb" "GoRedis/libs/stat" "GoRedis/libs/stdlog" "bufio" "fmt" "io" "os" "strconv" "sync" ) var slavelog = stdlog.Log("slaveof") type SlaveClient struct { ISlaveClient session *Session server *GoRedisServer buffer chan *Command // 缓存实时指令 rdbjobs chan int // 并发工作 wg sync.WaitGroup broken bool // 无效连接 counters *counter.Counters synclog *stat.Writer } func NewSlaveClient(server *GoRedisServer, session *Session) (s *SlaveClient, err error) { s = &SlaveClient{}