Documentation
¶
Index ¶
- func InitContext(ctx context.Context) context.Context
- func RecordCacheDelete(ctx context.Context, start time.Time)
- func RecordCacheHit(ctx context.Context, duration time.Duration)
- func RecordCacheMiss(ctx context.Context, duration time.Duration)
- func RecordCacheStore(ctx context.Context, start time.Time)
- func RecordMultiGet(ctx context.Context, hits, misses int, duration time.Duration)
- func ResetContext(ctx context.Context) context.Context
- type CacheMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitContext ¶
InitContext adds a cache metrics struct to the context to allow keeping track of cache calls during a request
func RecordCacheDelete ¶
RecordCacheDelete records a deletion from the cache
func RecordCacheHit ¶
RecordCacheHit records a cache hit
func RecordCacheMiss ¶
RecordCacheMiss records a cache miss
func RecordCacheStore ¶
RecordCacheStore records store data in the cache
func RecordMultiGet ¶
RecordMultiGet records getting multiple objects from the cache
Types ¶
type CacheMetrics ¶
type CacheMetrics struct {
// contains filtered or unexported fields
}
CacheMetrics keeps track of cache calls during a request
func GetMetrics ¶
func GetMetrics(ctx context.Context) (*CacheMetrics, error)
GetMetrics returns the cache metrics structure from the context, errors out if it is not there.
func (*CacheMetrics) GetCounters ¶ added in v1.3.0
func (m *CacheMetrics) GetCounters() (int, int, int)
GetCounters returns the number of cache calls, hits and misses
func (*CacheMetrics) GetTotalDuration ¶
func (m *CacheMetrics) GetTotalDuration() time.Duration
GetTotalDuration returns the sum of the time spend calling the cache
func (*CacheMetrics) HadCalls ¶
func (m *CacheMetrics) HadCalls() bool
HadCalls returns true if there were any cache calls