func NewProxy(min_pool int64, logger *log.WOFLogger) *Proxy {

	api_client := api.NewAPIClient()
	pool := pool.NewLIFOPool()

	// See notes in RefillPool() for details

	size := 10
	refill := make(chan bool, 10)

	for i := 0; i < size; i++ {
		refill <- true
	}

	// Possibly also keep global stats on number of fetches
	// and cache hits/misses/etc

	proxy := Proxy{
		logger:  logger,
		client:  api_client,
		pool:    pool,
		minpool: min_pool,
		refill:  refill,
	}

	return &proxy
}
예제 #2
0
func main() {

	client := api.NewAPIClient()
	i, _ := client.CreateInteger()

	fmt.Println(i)
}
func NewProxy(min_pool int64) *Proxy {

	client := api.NewAPIClient()
	pool := NewPool()

	proxy := Proxy{
		Client:  client,
		Pool:    pool,
		MinPool: min_pool,
	}

	return &proxy
}