Пример #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
// Get new resolver with given ttl
func NewResolver(ttl int) clb.LoadBalancer {
	lib := dns.NewDefaultLookupLib()
	cache := ttlcache.NewTtlCache(lib, ttl)
	return clb.NewRoundRobinClb(cache)
}