// Get returns a bufio.Writer which writes to w. The buffer size is that of the pool.
555068
func (bufPool *BufioWriterPool) Get(w io.Writer) *bufio.Writer {
	buf := bufPool.pool.Get().(*bufio.Writer)
	buf.Reset(w)
	return buf
}
305445
func (p *Pool) Get() (Client, error) {

	selected := nodeList{}
	var node Node
	var err error
	// select node to connect to
	for {
		node, err = p.selectNode(selected)
		if err != nil {
			return nil, err
		}

		conn := p.getPool(node.Addr).Get()
		if conn.Err() != nil {
			selected = append(selected, node)
			continue
		}

		return &RedisClient{
			conn: conn,
			node: node,
		}, nil
	}

}
705870
func Get() (p []byte, err error) {
	var inf m.MemInfo
	err = inf.Get()
	if err != nil {
		return nil, err
	}
	return json.Marshal(&inf)
}
1023592
func (pool *connPool) Get() net.Conn {
	pool.mu.Lock()
	defer pool.mu.Unlock()
	if len(pool.conns) > 0 {
		c := pool.conns[len(pool.conns)-1]
		pool.conns = pool.conns[0 : len(pool.conns)-1]
		atomic.AddInt64(&pool.stats.reusuedConnections, 1)
		return c
	}
	return nil
}
1306707
func (client *S3Blobstore) Get(src string, dest io.WriterAt) error {
	downloader := s3manager.NewDownloaderWithClient(client.s3Client)

	_, err := downloader.Download(dest, &s3.GetObjectInput{
		Bucket: aws.String(client.s3cliConfig.BucketName),
		Key:    client.key(src),
	})

	if err != nil {
		return err
	}

	return nil
}
860013
func (db *DB) Get(key []byte) ([]byte, error) {
	if err := checkKeySize(key); err != nil {
		return nil, err
	}

	key = db.encodeKVKey(key)

	return db.bucket.Get(key)
}
184505
func (bp *BufferPool) Get() *bytes.Buffer {
	return bp.pool.Get().(*bytes.Buffer)
}
1000846
func (g *Generator) Get() int32 {
	if !g.queue.empty() {
		return g.queue.pop()
	}
	if g.max == math.MaxInt32 {
		// Reset counter to 0? Can this be even possible?
		atomic.StoreInt32(&g.max, 0)
		return atomic.LoadInt32(&g.max)
	}
	return atomic.AddInt32(&g.max, 1)
}
1169965
func (p *Bytes) Get(sz int) []byte {
	var c []byte
	select {
	case c = <-p.pool:
	default:
		return make([]byte, sz)
	}

	if cap(c) < sz {
		return make([]byte, sz)
	}

	return c[:sz]
}
572022
func (p *Pool) get() (Conn, error) {
	p.mu.Lock()

	if p.closed {
		p.mu.Unlock()
		return nil, errors.New("redigo: get on closed pool")
	}

	// Prune stale connections.

	if timeout := p.IdleTimeout; timeout > 0 {
		for i, n := 0, p.idle.Len(); i < n; i++ {
			e := p.idle.Back()
			if e == nil {
				break
			}
			ic := e.Value.(idleConn)
			if ic.t.Add(timeout).After(nowFunc()) {
				break
			}
			p.idle.Remove(e)
			p.active -= 1
			p.mu.Unlock()
			ic.c.Close()
			p.mu.Lock()
		}
	}

	// Get idle connection.

	for i, n := 0, p.idle.Len(); i < n; i++ {
		e := p.idle.Front()
		if e == nil {
			break
		}
		ic := e.Value.(idleConn)
		p.idle.Remove(e)
		test := p.TestOnBorrow
		p.mu.Unlock()
		if test == nil || test(ic.c, ic.t) == nil {
			return ic.c, nil
		}
		ic.c.Close()
		p.mu.Lock()
		p.active -= 1
	}

	if p.MaxActive > 0 && p.active >= p.MaxActive {
		p.mu.Unlock()
		return nil, ErrPoolExhausted
	}

	// No idle connection, create new.

	dial := p.Dial
	p.active += 1
	p.mu.Unlock()
	c, err := dial()
	if err != nil {
		p.mu.Lock()
		p.active -= 1
		p.mu.Unlock()
		c = nil
	}
	return c, err
}
1280733
func (c *channelPool) Get() (net.Conn, error) {
	conns, factory := c.getConnsAndFactory()
	if conns == nil {
		return nil, ErrClosed
	}

	// wrap our connections with out custom net.Conn implementation (wrapConn
	// method) that puts the connection back to the pool if it's closed.
	select {
	case conn := <-conns:
		if conn == nil {
			return nil, ErrClosed
		}

		return c.wrapConn(conn), nil
	default:
		conn, err := factory()
		if err != nil {
			return nil, err
		}

		return c.wrapConn(conn), nil
	}
}
966676
func (c *BufferLRU) Get(key int64) ([]byte, bool) {
	c.mut.Lock()
	defer c.mut.Unlock()

	ee, ok := c.cache[key]
	if !ok {
		return nil, false
	}

	c.ll.MoveToFront(ee)
	return ee.Value.(buffer).Slice, true
}
124494
func (p *encoderPool) Get(w io.Writer) Encoder {
	if p.pool == nil {
		return p.fn(w)
	}

	e := p.pool.Get().(ResettableEncoder)
	e.Reset(w)
	return e
}
1188152
func (cp *Pool) Get(ctx context.Context) (*DBConn, error) {
	span, ctx := trace.NewSpan(ctx, "Pool.Get")
	defer span.Finish()

	if cp.isCallerIDAppDebug(ctx) {
		return NewDBConnNoPool(cp.appDebugParams, cp.dbaPool)
	}
	p := cp.pool()
	if p == nil {
		return nil, ErrConnPoolClosed
	}
	span.Annotate("capacity", p.Capacity())
	span.Annotate("in_use", p.InUse())
	span.Annotate("available", p.Available())
	span.Annotate("active", p.Active())

	r, err := p.Get(ctx)
	if err != nil {
		return nil, err
	}
	return r.(*DBConn), nil
}
629284
func (p *cbPool) Get(ptr unsafe.Pointer) interface{} {
	p.m.RLock()
	defer p.m.RUnlock()
	p.checkPointer(ptr)
	id := *(*int)(ptr) - 1
	if id == -1 {
		panic("Attempt to get nonexistent value from pool")
	}
	return p.objects[id]
}
1326728
func (b *bufp) Get() *bytes.Buffer {
	buffer := b.Pool.Get().(*bytes.Buffer)
	buffer.Reset()

	return buffer
}
598404
func (p *Generic) Get(sz int) interface{} {
	var c interface{}
	select {
	case c = <-p.pool:
	default:
		c = p.fn(sz)
	}

	return c
}