// ClearFromDelete clears the current cache if there is a delete that we don't know about
// and returns true to the caller if it schedules a background loader job
770643
func (s *HybridConversationSource) ClearFromDelete(ctx context.Context, uid gregor1.UID,
	convID chat1.ConversationID, deleteID chat1.MessageID) bool {
	defer s.Trace(ctx, func() error { return nil }, "ClearFromDelete")()

	// Check to see if we have the message stored
	stored, err := s.storage.FetchMessages(ctx, convID, uid, []chat1.MessageID{deleteID})
	if err == nil && stored[0] != nil {
		// Any error is grounds to load this guy into the conv loader aggressively
		s.Debug(ctx, "ClearFromDelete: delete message stored, doing nothing")
		return false
	}

	// Fire off a background load of the thread with a post hook to delete the bodies cache
	s.Debug(ctx, "ClearFromDelete: delete not found, clearing")
	p := &chat1.Pagination{Num: s.numExpungeReload}
	s.G().ConvLoader.Queue(ctx, types.NewConvLoaderJob(convID, nil /*query */, p, types.ConvLoaderPriorityHighest,
		func(ctx context.Context, tv chat1.ThreadView, job types.ConvLoaderJob) {
			if len(tv.Messages) == 0 {
				return
			}
			bound := tv.Messages[0].GetMessageID().Min(tv.Messages[len(tv.Messages)-1].GetMessageID())
			if err := s.storage.ClearBefore(ctx, convID, uid, bound); err != nil {
				s.Debug(ctx, "ClearFromDelete: failed to clear messages: %s", err)
			}
		}))
	return true
}
879085
func (c *MysqlCacher) Delete(key string) error {
	_, err := c.c.Exec("DELETE FROM cache WHERE `key`=?", c.md5(key))
	return err
}
1300398
func (s *GenericStorage) Delete(key interface{}) error {
	if s.del == nil && s.delMulti == nil {
		return errors.Newf(
			"'%s' does not have Delete/DeleteMulti implementation",
			s.name)
	}

	s.rwMutex.Lock()
	defer s.rwMutex.Unlock()

	if s.del != nil {
		return s.del(key)
	}
	return s.delMulti(key)
}
819445
func (c *Cache) Delete(key string) {
	c.db.Delete([]byte(key), nil)
}
746443
func SynchronousDelete(ctx context.Context, o *DeleteOptions) error {
	o.Synchronous = true
	return nil
}
575936
func (c *Cache) Delete(key Key) {
	logger.Debugf("%s - Deleting cache key", key.String())
	value, ok := c.m.Load(key.String())
	if ok {
		c.close(key.String(), value.(future))
		c.m.Delete(key.String())
	}
}
796229
func (m *MongoCache) delete(key string) error {
	query := func(c *mgo.Collection) error {
		err := c.RemoveId(key)
		return err
	}

	return m.run(m.CollectionName, query)
}
582574
func (this *MemoryStore) Clear() error {
	this.l.Lock()
	defer this.l.Unlock()
	this.newMap()
	return nil
}
157500
func (s *RateLimitedStorage) Delete(key interface{}) error {
	s.wait()
	defer s.signal()

	return s.storage.Delete(key)
}
556033
func (c *Cacher) Delete(ctx context.Context, key string, out runtime.Object, preconditions *storage.Preconditions) error {
	return c.storage.Delete(ctx, key, out, preconditions)
}
824644
func (dbcr *DiskBlockCacheRemote) Delete(
	ctx context.Context, blockIDs []kbfsblock.ID,
	cacheType DiskBlockCacheType) (
	numRemoved int, sizeRemoved int64, err error) {
	numBlocks := len(blockIDs)
	dbcr.log.LazyTrace(ctx, "DiskBlockCacheRemote: Delete %s block(s)",
		numBlocks)
	defer func() {
		dbcr.log.LazyTrace(ctx, "DiskBlockCacheRemote: Delete %s block(s) "+
			"done (err=%+v)", numBlocks, err)
	}()
	blocks := make([][]byte, 0, len(blockIDs))
	for _, b := range blockIDs {
		blocks = append(blocks, b.Bytes())
	}
	res, err := dbcr.client.DeleteBlocks(ctx, blocks)
	if err != nil {
		return 0, 0, err
	}
	return res.NumRemoved, res.SizeRemoved, nil
}
408659
func (c *cachedFS) Delete(ctx context.Context, path string) error {
	err := c.cache.Delete(ctx, path)
	if err != nil && !IsNotExist(err) {
		return err
	}
	return c.src.Delete(ctx, path)
}
457232
func (c *SyncCollector) Clear() {
	for k := range c.c {
		c.rw.Lock()
		delete(c.c, k)
		c.rw.Unlock()
	}
}
874678
func (c *CacheStorage) DeleteCache(cacheId string) (*gcdmessage.ChromeResponse, error) {
	var v CacheStorageDeleteCacheParams
	v.CacheId = cacheId
	return c.DeleteCacheWithParams(&v)
}
907536
func (cache *DiskBlockCacheLocal) ClearAllTlfBlocks(
	ctx context.Context, tlfID tlf.ID) (err error) {
	defer func() {
		cache.log.CDebugf(ctx,
			"Finished clearing blocks from %s: %+v", tlfID, err)
	}()

	// Delete the blocks in batches, so we don't keep the lock for too
	// long.
	for {
		cache.log.CDebugf(ctx, "Deleting a batch of blocks from %s", tlfID)
		numLeft, err := cache.deleteNextBatchFromClearedTlf(ctx, tlfID)
		if err != nil {
			return err
		}
		if numLeft == 0 {
			cache.log.CDebugf(ctx, "Deleted all blocks from %s", tlfID)
			return nil
		}
		cache.log.CDebugf(
			ctx, "%d blocks left to delete from %s", numLeft, tlfID)

		c := time.After(cache.clearTickerDuration)
		select {
		case <-c:
		case <-ctx.Done():
			return ctx.Err()
		}
	}
}
12551
func (c *InMemoryCache) Delete(_ context.Context, key Key) bool {
	if _, found := c.items.Load(key.String()); found {
		c.items.Delete(key.String())
		return true
	}
	return false
}
292291
func (c *Cache) DeleteAll() {
	var keys []interface{}
	c.m.Range(func(key interface{}, value interface{}) bool {
		c.close(key.(string), value.(future))
		keys = append(keys, key)
		return true
	})

	for _, key := range keys {
		c.m.Delete(key)
	}
}