// Get returns a bytes.Buffer from the specified pool
184505
func (bp *BufferPool) Get() *bytes.Buffer {
	return bp.pool.Get().(*bytes.Buffer)
}
314650
func (b *CircularBuffer) Get() interface{} {
	_ = <-b.avail

	b.lock.Lock()
	defer b.lock.Unlock()

	if b.start == b.pos {
		panic("Trying to get from empty buffer")
	}

	v := b.buffer[b.start]
	b.buffer[b.start] = nil
	b.start = (b.start + 1) % b.size

	return v
}
880059
func (b *Bucket) Get(k string, rv interface{}) error {
	return b.Gets(k, rv, nil)
}
519256
func (b *Bucket) Get(key []byte) ([]byte, error) {
	return b.GetFn(key)
}
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]
}
598404
func (p *Generic) Get(sz int) interface{} {
	var c interface{}
	select {
	case c = <-p.pool:
	default:
		c = p.fn(sz)
	}

	return c
}
327107
func (tp *BytePool) Get(size int) []byte {
	if size < 1 || size > tp.maxSize {
		return make([]byte, size)
	}
	var x []byte

	o := log2Ceil(uint32(size))
	p := &tp.list_of_pools[o]
	p.mu.Lock()
	if n := len(p.list); n > 0 {
		x = p.list[n-1]
		p.list[n-1] = nil
		p.list = p.list[:n-1]
	}
	p.mu.Unlock()
	if x == nil {
		x = make([]byte, 1<<o)
	}
	return x[:size]
}
1028044
func (r *Redis) Get(key string, target interface{}) bool {
	if "" == key {
		return false
	}

	value := reflect.ValueOf(target)
	if value.Type().Kind() != reflect.Ptr {
		errors.Panic(errors.ConstError("target should be pointer"))
	}
	if !r.Exists(key) {
		return false
	}

	conn := r.Pool.Get()
	defer conn.Close()
	if v, err := conn.Do("GET", key); err != nil {
		panic(err)
	} else {
		inBuf := bytes.NewBuffer(v.([]byte))
		if err := gob.NewDecoder(inBuf).Decode(target); err != nil {
			panic(err)
		} else {
			log.WithFields(log.Fields{"data": target, "key": key}).Debug("get value from cache")
			return true
		}
	}
}
774986
func (p *Pool) Get(path string) (*Connection, error) {
	p.mu.Lock()
	defer p.mu.Unlock()

	if c, ok := p.connections[path]; ok {
		c.increment()
		return c, nil
	}
	if _, err := os.Stat(filepath.Dir(path)); os.IsNotExist(err) {
		if err := os.MkdirAll(filepath.Dir(path), p.options.DirMode); err != nil {
			return nil, err
		}
	} else if err != nil {
		return nil, err
	}
	db, err := bolt.Open(path, p.options.FileMode, p.options.BoltOptions)
	if err != nil {
		return nil, err
	}
	c := &Connection{
		DB:      db,
		path:    path,
		pool:    p,
		expires: p.options.ConnectionExpires,
		mu:      &sync.RWMutex{},
	}
	p.connections[path] = c

	c.increment()
	return c, nil
}
808115
func (rb *RingBuffer) Get() (interface{}, error) {
	var n *node
	pos := atomic.LoadUint64(&rb.dequeue)
	i := 0
L:
	for {
		if atomic.LoadUint64(&rb.disposed) == 1 {
			return nil, ErrDisposed
		}

		n = rb.nodes[pos&rb.mask]
		seq := atomic.LoadUint64(&n.position)
		switch dif := seq - (pos + 1); {
		case dif == 0:
			if atomic.CompareAndSwapUint64(&rb.dequeue, pos, pos+1) {
				break L
			}
		case dif < 0:
			panic(`Ring buffer in compromised state during a get operation.`)
		default:
			pos = atomic.LoadUint64(&rb.dequeue)
		}

		if i == 10000 {
			runtime.Gosched() // free up the cpu before the next iteration
			i = 0
		} else {
			i++
		}
	}
	data := n.data
	n.data = nil
	atomic.StoreUint64(&n.position, pos+rb.mask+1)
	return data, nil
}
22528
func (p *Pool) Get(n, c int) []byte {
	if n > c {
		panic("requested length is greater than capacity")
	}

	v, x := p.pool.Get(c)
	if v != nil {
		bts := v.([]byte)
		bts = bts[:n]
		return bts
	}

	return make([]byte, n, x)
}
228248
func (p *decoderPool) Get(r io.Reader) Decoder {
	if p.pool == nil {
		return p.fn(r)
	}

	d := p.pool.Get().(ResettableDecoder)
	d.Reset(r)
	return d
}
1201608
func (b *Backend) Get(ctx context.Context, key string) (retEntry *physical.Entry, retErr error) {
	defer metrics.MeasureSince(metricGet, time.Now())

	// Pooling
	b.permitPool.Acquire()
	defer b.permitPool.Release()

	// Read
	r, err := b.client.Bucket(b.bucket).Object(key).NewReader(ctx)
	if err == storage.ErrObjectNotExist {
		return nil, nil
	}
	if err != nil {
		return nil, errwrap.Wrapf(fmt.Sprintf("failed to read value for %q: {{err}}", key), err)
	}

	defer func() {
		closeErr := r.Close()
		if closeErr != nil {
			retErr = multierror.Append(retErr, errwrap.Wrapf("error closing connection: {{err}}", closeErr))
		}
	}()

	value, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, errwrap.Wrapf("failed to read value into a string: {{err}}", err)
	}

	return &physical.Entry{
		Key:   key,
		Value: value,
	}, nil
}
1275982
func (b *Bucket) Get(key []byte) ([]byte, error) {
	val := b.bucket.Get(key)
	if len(val) == 0 {
		return nil, kv.ErrKeyNotFound
	}

	return val, nil
}
553780
func (p *Pool) GetLen(n int) []byte {
	return p.Get(n, n)
}
473369
func (rp *ReaderPool) Get(r io.Reader, size int) *bufio.Reader {
	v, n := rp.pool.Get(size)
	if v != nil {
		br := v.(*bufio.Reader)
		br.Reset(r)
		return br
	}
	return bufio.NewReaderSize(r, n)
}
502584
func (pool *TxPool) Get(hash common.Hash) *types.Transaction {
	return pool.all.Get(hash)
}