From 58060ab20ae235c26522409ec48fd7b9818c29fb Mon Sep 17 00:00:00 2001 From: CareyWong Date: Sun, 22 Mar 2020 17:05:34 +0800 Subject: [PATCH] Add logs --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 2959422..ed8bcf1 100644 --- a/main.go +++ b/main.go @@ -92,6 +92,8 @@ func main() { return } + log.Println(longUrl, shortKey) + res.LongUrl = longUrl res.ShortUrl = "http://" + *domain + "/" + shortKey context.JSON(200, *res) @@ -130,6 +132,7 @@ func longToShort(longUrl string, ttl int) string { if _existsKey != "" { _, _ = redisClient.Do("expire", _existsKey, ttl) + log.Println("Hit cache: " + _existsKey) return _existsKey }