// removeCharmGetCache removes the cache directory that was previously
// used by the charms API endpoint. It is no longer necessary.
358560
func removeCharmGetCache(context Context) error {
	dataDir := context.AgentConfig().DataDir()
	cacheDir := filepath.Join(dataDir, "charm-get-cache")
	return os.RemoveAll(cacheDir)
}
874678
func (c *CacheStorage) DeleteCache(cacheId string) (*gcdmessage.ChromeResponse, error) {
	var v CacheStorageDeleteCacheParams
	v.CacheId = cacheId
	return c.DeleteCacheWithParams(&v)
}
817876
func (c *Context) ServiceCache(key string, res interface{}) (exists bool) {
	return c.getCacheVal("service", key, res)
}
579446
func (lic *LocalImageCache) GetCache(imgID string, config *containertypes.Config) (string, error) {
	return getImageIDAndError(getLocalCachedImage(lic.store, image.ID(imgID), config))
}
686096
func (c *Cache) removeOldest() (key string, value interface{}) {
	ele := c.ll.Back()
	if ele == nil {
		return
	}
	c.ll.Remove(ele)
	ent := ele.Value.(*entry)
	delete(c.cache, ent.key)
	return ent.key, ent.value

}
422477
func (t *SecureTrie) getSecKeyCache() map[string][]byte {
	if t != t.secKeyCacheOwner {
		t.secKeyCacheOwner = t
		t.secKeyCache = make(map[string][]byte)
	}
	return t.secKeyCache
}
280332
func (h *charmsHandler) processGet(r *http.Request, st *state.State) (
	archivePath string,
	fileArg string,
	serveIcon bool,
	err error,
) {
	errRet := func(err error) (string, string, bool, error) {
		return "", "", false, err
	}

	query := r.URL.Query()

	// Retrieve and validate query parameters.
	curlString := query.Get("url")
	if curlString == "" {
		return errRet(errors.Errorf("expected url=CharmURL query argument"))
	}
	curl, err := charm.ParseURL(curlString)
	if err != nil {
		return errRet(errors.Trace(err))
	}
	fileArg = query.Get("file")
	if fileArg != "" {
		fileArg = path.Clean(fileArg)
	} else if query.Get("icon") == "1" {
		serveIcon = true
		fileArg = "icon.svg"
	}

	store := storage.NewStorage(st.ModelUUID(), st.MongoSession())
	// Use the storage to retrieve and save the charm archive.
	ch, err := st.Charm(curl)
	if err != nil {
		return errRet(errors.Annotate(err, "cannot get charm from state"))
	}
	charmFileName, err := common.ReadCharmFromStorage(store, h.dataDir, ch.StoragePath())
	if err != nil {
		return errRet(errors.Annotatef(err, "cannot read charm %q from storage", curl))
	}
	return charmFileName, fileArg, serveIcon, nil
}
72933
func (c *MemoryCacher) Get(key string) interface{} {
	c.lock.RLock()
	defer c.lock.RUnlock()

	item, ok := c.items[key]
	if !ok {
		return nil
	}
	if item.hasExpired() {
		go c.Delete(key)
		return nil
	}
	return item.val
}
830633
func (c *Cache) Remove(key string) bool {
	if c.cache == nil {
		return false
	}

	if ele, hit := c.cache[key]; hit {
		c.removeElement(ele)
		return true
	}

	return false
}
419292
func (c *chatLocal) ClearCache() {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.selfConvInfos = nil
}
913375
func (c *LRUCache) removeOldest() {
	ele := c.ll.Back()
	if ele != nil {
		c.removeElement(ele)
	}
}
629689
func (n *NonceCache) InCache(nonce string) bool {
	n.Lock()
	defer n.Unlock()

	// check if the nonce is already in the cache
	_, exists := n.cache.Get(nonce)
	if exists {
		return true
	}

	// it's not, so let's put it in the cache
	n.cache.Set(nonce, "", n.cacheTTL)

	return false
}
1140397
func (al *assetLru) removeOldest() (key int64, value *assetCache) {
	ele := al.ll.Back()
	if ele == nil {
		return
	}
	al.ll.Remove(ele)
	ent := ele.Value
	delete(al.cache, ent.key)
	return ent.key, ent.value

}
1083394
func (m *MongoCache) StopGC() {
	if m.gcTicker != nil {
		m.Lock()
		m.gcTicker.Stop()
		m.gcTicker = nil
		close(m.done)
		m.done = nil
		m.Unlock()
	}
}
628749
func (e *TokensController) removeSecretReference(saNamespace string, saName string, saUID types.UID, secretName string) error {
	// We don't want to update the cache's copy of the service account
	// so remove the secret from a freshly retrieved copy of the service account
	serviceAccounts := e.client.CoreV1().ServiceAccounts(saNamespace)
	serviceAccount, err := serviceAccounts.Get(saName, metav1.GetOptions{})
	// Ignore NotFound errors when attempting to remove a reference
	if apierrors.IsNotFound(err) {
		return nil
	}
	if err != nil {
		return err
	}

	// Short-circuit if the UID doesn't match
	if len(saUID) > 0 && saUID != serviceAccount.UID {
		return nil
	}

	// Short-circuit if the secret is no longer referenced
	if !getSecretReferences(serviceAccount).Has(secretName) {
		return nil
	}

	// Remove the secret
	secrets := []v1.ObjectReference{}
	for _, s := range serviceAccount.Secrets {
		if s.Name != secretName {
			secrets = append(secrets, s)
		}
	}
	serviceAccount.Secrets = secrets
	_, err = serviceAccounts.Update(serviceAccount)
	// Ignore NotFound errors when attempting to remove a reference
	if apierrors.IsNotFound(err) {
		return nil
	}
	return err
}
1034551
func (c *Cache) removeElement(elem *list.Element) {
	it := c.l.Remove(elem).(*Item)
	delete(c.m, it.Key)
	// Update cached byte size.
	c.size -= it.Size
	// Call handler if it exists.
	if c.config.RemoveHandler != nil {
		c.config.RemoveHandler(*it)
	}
}
938142
func (c *ReasonCache) Remove(uid types.UID, name string) {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.cache.Remove(c.composeKey(uid, name))
}