Add logs
This commit is contained in:
parent
31dfd21d96
commit
58060ab20a
3
main.go
3
main.go
@ -92,6 +92,8 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Println(longUrl, shortKey)
|
||||||
|
|
||||||
res.LongUrl = longUrl
|
res.LongUrl = longUrl
|
||||||
res.ShortUrl = "http://" + *domain + "/" + shortKey
|
res.ShortUrl = "http://" + *domain + "/" + shortKey
|
||||||
context.JSON(200, *res)
|
context.JSON(200, *res)
|
||||||
@ -130,6 +132,7 @@ func longToShort(longUrl string, ttl int) string {
|
|||||||
if _existsKey != "" {
|
if _existsKey != "" {
|
||||||
_, _ = redisClient.Do("expire", _existsKey, ttl)
|
_, _ = redisClient.Do("expire", _existsKey, ttl)
|
||||||
|
|
||||||
|
log.Println("Hit cache: " + _existsKey)
|
||||||
return _existsKey
|
return _existsKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user