示例#1
0
func NewTtlCacheClb(address string, port string, lbType LoadBalancerType, ttl int) LoadBalancer {
	lib := dns.NewLookupLib(fmt.Sprintf("%s:%s", address, port))
	cache := ttlcache.NewTtlCache(lib, ttl)

	return buildClb(cache, lbType)
}
示例#2
0
文件: resolver.go 项目: godeep/goth
// Get new resolver with given ttl
func NewResolver(ttl int) clb.LoadBalancer {
	lib := dns.NewDefaultLookupLib()
	cache := ttlcache.NewTtlCache(lib, ttl)
	return clb.NewRoundRobinClb(cache)
}