示例#1
0
文件: redis.go 项目: tolexo/aero
// redis:
// - host
// - port
// - db
func RedisFromConfig(container string) Cacher {
	host := conf.String(container+".host", "")
	panik.If(host == "", "redis host not specified")

	port := conf.Int(container+".port", 0)
	panik.If(port == 0, "redis port not specified")

	db := conf.Int(container+".db", 0)

	return NewRedis(host, port, db)
}
示例#2
0
文件: memcache.go 项目: tolexo/aero
// memcache:
// - host
// - port
func MemcacheFromConfig(container string) Cacher {
	host := conf.String(container+".host", "")
	panik.If(host == "", "memcache host not specified")

	port := conf.Int(container+".port", 0)
	panik.If(port == 0, "memcache port not specified")

	return NewMemcache(host, port)
}