// 获取redis对象 func GetPutRedisObj(key string) (conn *rediscache.MemCache, err error) { rurls := strings.Split(GetConfVal("default::"+key), ":") conf := rediscache.MemConfig{} conf.Host = rurls[0] conf.Port = rurls[1] conf.Db = rurls[2] conn, err = rediscache.New(conf) conn.SelectDb(conf.Db) return }
// 获取redis对象 func GetRedisObj(iniPath string, section string, db string) ([]*rediscache.MemCache, error) { confObj, err := GetConfObj(iniPath) if err != nil { return nil, errors.Trace(err) } conf := rediscache.MemConfig{} conf.Host = confObj.String(section + "::" + "host") conf.Port = confObj.String(section + "::" + "port") conf.Db = db return rediscache.NewMul(conf, 2) }