cache icon indicating copy to clipboard operation
cache copied to clipboard

Add cache hit field in Item

Open zacscoding opened this issue 3 years ago • 0 comments

Add cache hit field in Item.

Hello :) I want to record cache metrics with labels when calling Once function like below

	item := &Item{}
	if err := cache.Once(item); err != nil {
		return err
	}

	metrics.IncCacheTotal("product")
	if item.CacheHit {
		metrics.IncCacheHit("product")
	}

I found Stats() function but this function provides only total count of hits and misses :(

zacscoding avatar Feb 09 '22 09:02 zacscoding