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)
- type CacheMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitContext ¶
InitContext adds a DB metrics struct to the context to allow keeping track of DB 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
Types ¶
type CacheMetrics ¶
type CacheMetrics struct { Calls int Hits int Misses int Deletions int GetLatencies time.Duration StoreLatencies time.Duration DeletionLatencies time.Duration }
CacheMetrics keeps track of DB calls during a request
func GetMetrics ¶
func GetMetrics(ctx context.Context) (*CacheMetrics, error)
GetMetrics returns the DB metrics structure from the context, errors out if it is not there.
func (*CacheMetrics) GetTotalDuration ¶
func (m *CacheMetrics) GetTotalDuration() time.Duration
GetTotalDuration returns the sum of the time spend calling the DB
func (*CacheMetrics) HadCalls ¶
func (m *CacheMetrics) HadCalls() bool
HadCalls returns true if there were any DB calls
Click to show internal directories.
Click to hide internal directories.