From 48ad0202bf70af1635beb3fb3f539c4e2f5bb119 Mon Sep 17 00:00:00 2001 From: astaxie Date: Sat, 7 Dec 2013 13:26:22 +0800 Subject: [PATCH] update some tips --- admin.go | 11 ++++++++++- httplib/httplib_test.go | 2 +- logs/conn.go | 3 +-- session/README.md | 14 +++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/admin.go b/admin.go index 64b6610a..751c8c1e 100644 --- a/admin.go +++ b/admin.go @@ -53,7 +53,16 @@ func ProfIndex(rw http.ResponseWriter, r *http.Request) { if command != "" { toolbox.ProcessInput(command, rw) } else { - rw.Write([]byte("request url like '/prof?command=lookup goroutine'")) + rw.Write([]byte("request url like '/prof?command=lookup goroutine'\n")) + rw.Write([]byte("the command have below types:\n")) + rw.Write([]byte("1. lookup goroutine\n")) + rw.Write([]byte("2. lookup heap\n")) + rw.Write([]byte("3. lookup threadcreate\n")) + rw.Write([]byte("4. lookup block\n")) + rw.Write([]byte("5. start cpuprof\n")) + rw.Write([]byte("6. stop cpuprof\n")) + rw.Write([]byte("7. get memprof\n")) + rw.Write([]byte("8. gc summary\n")) } } diff --git a/httplib/httplib_test.go b/httplib/httplib_test.go index 00392318..cc56dd88 100644 --- a/httplib/httplib_test.go +++ b/httplib/httplib_test.go @@ -6,7 +6,7 @@ import ( ) func TestGetUrl(t *testing.T) { - resp, err := Get("http://beego.me/").Response() + resp, err := Get("http://beego.me/").Debug(true).Response() if err != nil { t.Fatal(err) } diff --git a/logs/conn.go b/logs/conn.go index 532092d1..8ad588b9 100644 --- a/logs/conn.go +++ b/logs/conn.go @@ -87,8 +87,7 @@ func (c *ConnWriter) connect() error { return err } - tcpConn, ok := conn.(*net.TCPConn) - if ok { + if tcpConn, ok := conn.(*net.TCPConn); ok { tcpConn.SetKeepAlive(true) } diff --git a/session/README.md b/session/README.md index ebc25a5a..220100ef 100644 --- a/session/README.md +++ b/session/README.md @@ -81,17 +81,21 @@ Writing a provider is easy. You only need to define two struct types Maybe you will find the **memory** provider as good example. type SessionStore interface { - Set(key, value interface{}) error // set session value - Get(key interface{}) interface{} // get session value - Delete(key interface{}) error // delete session value - SessionID() string // return current sessionID - SessionRelease() // release the resource + Set(key, value interface{}) error //set session value + Get(key interface{}) interface{} //get session value + Delete(key interface{}) error //delete session value + SessionID() string //back current sessionID + SessionRelease() // release the resource & save data to provider + Flush() error //delete all data } type Provider interface { SessionInit(maxlifetime int64, savePath string) error SessionRead(sid string) (SessionStore, error) + SessionExist(sid string) bool + SessionRegenerate(oldsid, sid string) (SessionStore, error) SessionDestroy(sid string) error + SessionAll() int //get all active session SessionGC() }