Beispiel #1
0
// 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)
}
Beispiel #2
0
// 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)
}