// Get returns the Block in the Cache with the specified base or a nil Block
// if it does not exist.
176432
func (c *LRU) Get(base int64) bgzf.Block {
	c.mu.Lock()
	defer c.mu.Unlock()

	n, ok := c.table[base]
	if !ok {
		return nil
	}
	remove(n, c.table)
	return n.b
}
1351251
func (c *ARCCache) Get(key interface{}) (value interface{}, ok bool) {
	c.lock.Lock()
	defer c.lock.Unlock()

	// If the value is contained in T1 (recent), then
	// promote it to T2 (frequent)
	if val, ok := c.t1.Peek(key); ok {
		c.t1.Remove(key)
		c.t2.Add(key, val)
		return val, ok
	}

	// Check if the value is contained in T2 (frequent)
	if val, ok := c.t2.Get(key); ok {
		return val, ok
	}

	// No hit
	return nil, false
}
214023
func (c *fileCache) Get(key string) ([]byte, error) {
	cached, err := ioutil.ReadFile(c.filename(key))
	if err != nil {
		// check the error
		if _, ok := err.(*os.PathError); !ok {
			return nil, err
		}
	}

	return cached, nil
}
441781
func (lru *LRUCache) Get(key string) (v Value, ok bool) {
	lru.mu.Lock()
	defer lru.mu.Unlock()

	element := lru.table[key]
	if element == nil {
		return nil, false
	}
	lru.moveToFront(element)
	return element.Value.(*entry).value, true
}
801402
func (c *Random) Get(base int64) bgzf.Block {
	c.mu.Lock()
	defer c.mu.Unlock()

	b, ok := c.table[base]
	if !ok {
		return nil
	}
	delete(c.table, base)
	return b
}
771283
func (c *Client) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error) {
	return c.GetBlockAsync(blockHash).Receive()
}
228511
func (bc *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block {
	// Short circuit if the block's already in the cache, retrieve otherwise
	if block, ok := bc.blockCache.Get(hash); ok {
		return block.(*types.Block)
	}
	block := rawdb.ReadBlock(bc.db, hash, number)
	if block == nil {
		return nil
	}
	// Cache the found block for next time and return
	bc.blockCache.Add(block.Hash(), block)
	return block
}
812275
func (bam BlockAddressMap) Get(loc BlockLocation) string {
	if bam[loc.FileIndex] == nil {
		return ""
	}
	return bam[loc.FileIndex][loc.BlockIndex]
}
118958
func (c *Cacher) Get(key string) map[string]interface{} {
	c.mu.RLock()
	defer c.mu.RUnlock()
	if v, ok := c.data[key]; ok {
		return map[string]interface{}{
			key: v,
		}
	}
	ret := make(map[string]interface{})
	for k, v := range c.data {
		if strings.HasPrefix(k, key) {
			ret[k] = v
		}
	}
	return ret
}
614751
func (c *Cache) Get(key string) (resp []byte, ok bool) {
	var err error
	resp, err = c.db.Get([]byte(key), nil)
	if err != nil {
		return []byte{}, false
	}
	return resp, true
}
570254
func (s *CacheOnStorage) Get(key interface{}) (interface{}, error) {
	if item, err := s.cache.Get(key); err != nil {
		return nil, err
	} else if item != nil {
		return item, nil
	}

	item, err := s.storage.Get(key)
	if err != nil {
		return nil, err
	}

	if err := s.cache.Set(item); err != nil {
		// XXX: Maybe make this a non error
		return nil, err
	}
	return item, nil
}
442695
func (c *writeTroughCache) Get(key string) ([]byte, error) {
	// Try to read from memory cache
	data, err := c.memory.Get(key)
	if err != nil {
		return nil, err
	}

	if data != nil {
		return data, nil
	}

	// Try to read from cache file
	data, err = c.file.Get(key)
	if err != nil {
		return nil, err
	}

	// Store in memory cache and return
	err = c.memory.Set(key, data)
	if err != nil {
		return nil, err
	}

	return data, nil
}
1072878
func (c *Cache) Get(key string) (resp []byte, ok bool) {
	key = keyToFilename(key)
	resp, err := c.d.Read(key)
	if err != nil {
		return []byte{}, false
	}
	return resp, true
}
1030983
func (cdb *CacheDB) Get(key []byte) []byte {
	value, deleted := cdb.cache.Info(key)
	if deleted {
		return nil
	}
	if value != nil {
		return value
	}
	return cdb.backend.Get(key)
}
801973
func (sc *StorageCache) Get(c context.Context, key storage.CacheKey) ([]byte, bool) {
	itm, ok := storageCache.LRU(c).Get(c, key)
	if !ok {
		return nil, false
	}

	data := itm.([]byte)
	if len(data) == 0 {
		// No cache item (missing or invalid/empty).
		return nil, false
	}

	isCompressed, data := data[0], data[1:]
	if isCompressed != 0x00 {
		// This entry is compressed.
		zr, err := zlib.NewReader(bytes.NewReader(data))
		if err != nil {
			log.Fields{
				log.ErrorKey: err,
				"key":        key,
			}.Warningf(c, "Failed to create ZLIB reader.")
			return nil, false
		}
		defer zr.Close()

		if data, err = ioutil.ReadAll(zr); err != nil {
			log.Fields{
				log.ErrorKey: err,
				"key":        key,
			}.Warningf(c, "Failed to decompress cached item.")
			return nil, false
		}
	}
	return data, true
}
1125893
func (c *memoryCache) Get(key string) ([]byte, error) {
	c.RLock()
	defer c.RUnlock()

	cached, ok := c.cache[key]
	if ok {
		return cached, nil
	}

	return nil, nil
}
97176
func (lru *LRUCache) Get(key interface{}) (value interface{}, foundInCache bool) {
	lru.lock.Lock()
	defer lru.lock.Unlock()

	if element, ok := lru.mapping[key]; ok {
		lru.order.MoveToFront(element)
		return element.Value.(*pair).val, true
	}

	return nil, false
}