// Returns the number of items in the cache.
487054
func (c *ExpireCache) Size() int64 {
	defer c.mutex.Unlock()
	c.mutex.Lock()
	return int64(len(c.cache))
}
1301884
func (l *LFUNoTS) Get(key string) (interface{}, error) {
	res, err := l.cache.Get(key)
	if err != nil {
		return nil, err
	}

	ci := res.(*cacheItem)

	// increase usage of cache item
	l.incr(ci)
	return ci.v, nil
}
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
}
1165254
func (c *Cache) Get(key string) (value interface{}, ok bool) {
	c.Lock()
	defer c.Unlock()
	if it, ok := c.getItemPtr(key); ok {
		return it.Value, true
	}
	return nil, false
}
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
}
1238980
func (tc *TransCache) GetItemExpiryTime(chID, itmID string) (exp time.Time, ok bool) {
	tc.cacheMux.RLock()
	defer tc.cacheMux.RUnlock()
	return tc.cacheInstance(chID).GetItemExpiryTime(itmID)
}
697785
func cacheExpiry(c context.Context) time.Duration {
	rnd := time.Duration(mathrand.Int63n(c, int64(time.Minute)))
	return 4*time.Minute + rnd
}
172537
func (c *LRUCache) Size() int {
	defer c.mutex.Unlock()
	c.mutex.Lock()
	return c.ll.Len()
}
1004182
func (cache *Cache) HitCount() (count int64) {
	for i := range cache.segments {
		count += atomic.LoadInt64(&cache.segments[i].hitCount)
	}
	return
}
1187697
func (s *CacheOnStorage) GetMulti(
	keys ...interface{}) ([]interface{}, error) {

	results, err := s.cache.GetMulti(keys...)
	if err != nil {
		return nil, err
	}

	indices := make([]int, 0, len(keys))
	uncachedKeys := make([]interface{}, 0, len(keys))
	for i, item := range results {
		if item == nil {
			indices = append(indices, i)
			uncachedKeys = append(uncachedKeys, keys[i])
		}
	}

	uncachedItems, err := s.storage.GetMulti(uncachedKeys...)
	if err != nil {
		return nil, err
	}

	foundItems := make([]interface{}, 0, len(uncachedItems))
	for _, item := range uncachedItems {
		if item != nil {
			foundItems = append(foundItems, item)
		}
	}

	if err := s.cache.SetMulti(foundItems...); err != nil {
		// XXX: Maybe make this a non error
		return nil, err
	}

	for i, index := range indices {
		results[index] = uncachedItems[i]
	}

	return results, nil
}
284289
func (c *MempoolDataCache) GetNumTickets() (uint32, uint32) {
	c.mtx.RLock()
	defer c.mtx.RUnlock()
	return c.height, c.numTickets
}
1177138
func (c *Cache) Len() int {
	if c.cache == nil {
		return 0
	}
	return c.ll.Len()
}
205080
func (c *MemoryCacher) Get(key string) string {
	c.lock.RLock()
	defer c.lock.RUnlock()

	item, ok := c.items[key]
	if !ok {
		return ""
	}
	if item.expire > 0 &&
		(time.Now().Unix()-item.created) >= item.expire {
		go c.Delete(key)
		return ""
	}
	return item.val
}
125541
func (c *MemoryCache) Get(key string) (resp []byte, ok bool) {
	c.mu.RLock()
	resp, ok = c.items[key]
	c.mu.RUnlock()
	return resp, ok
}
748629
func (cache *Cache) EntryCount() (entryCount int64) {
	for i := range cache.segments {
		entryCount += atomic.LoadInt64(&cache.segments[i].entryCount)
	}
	return
}
1276888
func (c *rankCache) Len() int {
	c.mu.Lock()
	defer c.mu.Unlock()
	return len(c.entries)
}
618388
func (lru *LRUCache) Capacity() int64 {
	lru.mu.Lock()
	defer lru.mu.Unlock()
	return lru.capacity
}