From b9ba52b2a1af8478135c54314365270a7f65def4 Mon Sep 17 00:00:00 2001 From: Umputun Date: Mon, 8 Jan 2018 01:31:24 -0600 Subject: [PATCH] hit/miss debug --- app/rest/cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/rest/cache.go b/app/rest/cache.go index b47f8b52..78698f78 100644 --- a/app/rest/cache.go +++ b/app/rest/cache.go @@ -1,6 +1,7 @@ package rest import ( + "log" "time" cache "github.com/patrickmn/go-cache" @@ -16,9 +17,11 @@ func newLoadingCache(defaultExpiration, cleanupInterval time.Duration) *loadingC func (lc *loadingCache) get(key string, ttl time.Duration, fn func() ([]byte, error)) (data []byte, err error) { if b, ok := lc.bytesCache.Get(key); ok { + log.Printf("[DEBUG] cache hit %s", key) return b.([]byte), nil } + log.Printf("[DEBUG] cache miss %s", key) if data, err = fn(); err != nil { return data, err }