mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-23 04:36:49 +08:00
增加日志记录
This commit is contained in:
@@ -105,12 +105,15 @@ func (b *Blog) FindFromCache(blogId int) (blog *Blog,err error) {
|
|||||||
if b,ok := obj.(Blog); ok {
|
if b,ok := obj.(Blog); ok {
|
||||||
blog = &b
|
blog = &b
|
||||||
blog.Link()
|
blog.Link()
|
||||||
|
beego.Info("从缓存读取文章成功 ->", key)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
blog,err = b.Find(blogId)
|
blog,err = b.Find(blogId)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
//默认一个小时
|
//默认一个小时
|
||||||
cache.Put(key,blog,time.Hour * 1)
|
if err := cache.Put(key,*blog,time.Hour * 1); err != nil {
|
||||||
|
beego.Error("将文章存入缓存失败 ->",err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user