// Used when the cache was created with the Track() configuration option.
// Avoid otherwise
513174
func (c *Cache) TrackingGet(key string) TrackedItem {
	item := c.Get(key)
	if item == nil {
		return NilTracked
	}
	item.track()
	return item
}
1028771
func (t *Track) Availability() TrackAvailability {
	avail := C.sp_track_get_availability(
		t.session.sp_session,
		t.sp_track,
	)
	return TrackAvailability(avail)
}
782205
func (h *Handler) updateCache(request *Request) (*cacheEntry, error) {

	updateAddr := request.Addr()
	log.Trace("feed cache update", "topic", request.Topic.Hex(), "updateaddr", updateAddr, "epoch time", request.Epoch.Time, "epoch level", request.Epoch.Level)

	feedUpdate := h.get(&request.Feed)
	if feedUpdate == nil {
		feedUpdate = &cacheEntry{}
		h.set(&request.Feed, feedUpdate)
	}

	// update our rsrcs entry map
	feedUpdate.lastKey = updateAddr
	feedUpdate.Update = request.Update
	feedUpdate.Reader = bytes.NewReader(feedUpdate.data)
	return feedUpdate, nil
}
397457
func (o *EntryTracker) Track(b *logpb.ButlerLogBundle) {
	entries := b.GetEntries()
	if len(entries) == 0 {
		return
	}

	st := make([]*streamEntryTracker, len(entries))
	func() {
		o.mu.Lock()
		defer o.mu.Unlock()

		for i, e := range entries {
			st[i] = o.getOrCreateStreamLocked(e.GetDesc().Path())
		}
	}()

	for i, e := range entries {
		st[i].track(e.GetLogs())
	}
}
487416
func NewTrackToRemove(trackID string, positions []int) TrackToRemove {
	return TrackToRemove{
		URI:       fmt.Sprintf("spotify:track:%s", trackID),
		Positions: positions,
	}
}
1070584
func (s *Store) TrackValue(key string, value interface{}) {
	if !s.calculateHints {
		return
	}

	s.diffmu.Lock()
	var (
		d     *diff
		found bool
	)

	d, found = s.diffs[key]

	if !found {
		d = &diff{}
		s.diffs[key] = d
	}

	d.add(value)
	s.diffmu.Unlock()
}
142769
func ExportTrackDiff(d TrackDiff) (res *keybase1.TrackDiff) {
	if d != nil {
		res = &keybase1.TrackDiff{
			Type:          keybase1.TrackDiffType(d.GetTrackDiffType()),
			DisplayMarkup: d.ToDisplayString(),
		}
	}
	return
}
462517
func (k *k8sWatcher) updateCache() ([]*registry.Result, error) {
	podList, err := k.registry.client.ListPods(podSelector)
	if err != nil {
		return nil, err
	}

	k.RLock()
	k.RUnlock()

	var results []*registry.Result

	for _, pod := range podList.Items {
		rslts := k.buildPodResults(&pod, nil)

		for _, r := range rslts {
			results = append(results, r)
		}

		k.Lock()
		k.pods[pod.Metadata.Name] = &pod
		k.Unlock()
	}

	return results, nil
}
737598
func (c *Storage) TrackIndexedDBForOriginWithParams(v *StorageTrackIndexedDBForOriginParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Storage.trackIndexedDBForOrigin", Params: v})
}
549506
func (cb *configBased) AllCacheHits() uint64 {
	var total uint64
	for _, cache := range cb.metricCache {
		total += cache.allCacheHits()
	}
	return total
}
259968
func CacheBust(t string) option {
	return func(c *sass) error {
		if t == "ts" {
			t = "timestamp"
		}
		c.cachebust = t
		return nil
	}
}
1108177
func TrackDuration(f func() error) (time.Duration, error) {
	ts := timeNow()
	err := f()
	d := timeNow().Sub(ts)
	return d, err
}
943720
func deleteCacheHandler(w http.ResponseWriter, r *http.Request) {
	target := r.URL.Path[len(cachePath):]
	if err := cache.Delete(target); err != nil {
		if strings.Contains((err).Error(), "not found") {
			w.WriteHeader(http.StatusNotFound)
			log.Printf("%s not found.", target)
			return
		}
		w.WriteHeader(http.StatusInternalServerError)
		log.Printf("internal cache error: %s", err)
	}
	// this is what the RFC says to use when calling DELETE.
	w.WriteHeader(http.StatusOK)
	return
}
40027
func (c *SecondaryCache) TrackingGet(secondary string) TrackedItem {
	item := c.Get(secondary)
	if item == nil {
		return NilTracked
	}
	item.track()
	return item
}
777661
func useCached(downloadTime time.Time, maxAge int) bool {
	freshnessLifetime := int(time.Now().Sub(downloadTime).Seconds())
	if maxAge > 0 && freshnessLifetime < maxAge {
		return true
	}
	return false
}
447575
func EndOfTrack() *Event {
	return &Event{
		MsgType: uint8(EventByteMap["Meta"]),
		MsgChan: uint8(15),
		Cmd:     MetaByteMap["End of Track"],
	}
}
342758
func (u *Ui) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser {
	pl := &TrackProgressParameters{
		Src:         src,
		CurrentSize: currentSize,
		TotalSize:   totalSize,
	}
	var trackingID string
	if err := u.client.Call("Ui.NewTrackProgress", pl, &trackingID); err != nil {
		log.Printf("Error in Ui.NewTrackProgress RPC call: %s", err)
		return stream
	}
	cli := &ProgressTrackingClient{
		id:     trackingID,
		client: u.client,
		stream: stream,
	}
	return cli
}