Example #1
0
File: fun.go Project: qgweb/new
// 获取redis对象
func GetZJDxRedisObj() (*rediscache.MemCache, error) {
	rurls := strings.Split(GetConfVal("zhejiang::dx_redis_url"), ":")
	conf := rediscache.MemConfig{}
	conf.Host = rurls[0]
	conf.Port = rurls[1]
	return rediscache.New(conf)
}
Example #2
0
File: fun.go Project: qgweb/new
// 获取redis对象
func GetRedisObj() (*rediscache.MemCache, error) {
	rurls := strings.Split(GetConfVal("default::put_redis_url"), ":")
	conf := rediscache.MemConfig{}
	conf.Host = rurls[0]
	conf.Port = rurls[1]
	return rediscache.New(conf)
}
Example #3
0
File: fun.go Project: qgweb/new
// 获取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
}
Example #4
0
File: fun.go Project: qgweb/new
// 获取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)
}