本文整理匯總了Golang中github.com/shingetsu-gou/shingetsu-gou/thread.Cache.Subscribe方法的典型用法代碼示例。如果您正苦於以下問題:Golang Cache.Subscribe方法的具體用法?Golang Cache.Subscribe怎麽用?Golang Cache.Subscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/shingetsu-gou/shingetsu-gou/thread.Cache
的用法示例。
在下文中一共展示了Cache.Subscribe方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: printThreadHead
//printThreadHead renders head part of thread page with cookie.
func (t *threadCGI) printThreadHead(path, id string, page int, ca *thread.Cache, rss string) error {
switch {
case ca.HasRecord():
if !t.IsBot() {
download.GetCache(true, ca)
} else {
log.Println("bot detected, not get cache")
}
case t.CheckGetCache():
ca.Subscribe()
if t.Req.FormValue("search_new_file") == "" {
download.GetCache(true, ca)
}
default:
t.Print404(nil, id)
return errors.New("no records")
}
var access string
var newcookie []*http.Cookie
if ca.HasRecord() && id == "" && page == 0 {
cookie, err := t.Req.Cookie("access")
if err == nil {
access = cookie.Value
} else {
log.Println(err)
}
newcookie = t.setCookie(ca, access)
}
t.Header(path, rss, newcookie, false)
return nil
}