update some tips
Showing
4 changed files
with
21 additions
and
9 deletions
| ... | @@ -53,7 +53,16 @@ func ProfIndex(rw http.ResponseWriter, r *http.Request) { | ... | @@ -53,7 +53,16 @@ func ProfIndex(rw http.ResponseWriter, r *http.Request) { |
| 53 | if command != "" { | 53 | if command != "" { |
| 54 | toolbox.ProcessInput(command, rw) | 54 | toolbox.ProcessInput(command, rw) |
| 55 | } else { | 55 | } else { |
| 56 | rw.Write([]byte("request url like '/prof?command=lookup goroutine'")) | 56 | rw.Write([]byte("request url like '/prof?command=lookup goroutine'\n")) |
| 57 | rw.Write([]byte("the command have below types:\n")) | ||
| 58 | rw.Write([]byte("1. lookup goroutine\n")) | ||
| 59 | rw.Write([]byte("2. lookup heap\n")) | ||
| 60 | rw.Write([]byte("3. lookup threadcreate\n")) | ||
| 61 | rw.Write([]byte("4. lookup block\n")) | ||
| 62 | rw.Write([]byte("5. start cpuprof\n")) | ||
| 63 | rw.Write([]byte("6. stop cpuprof\n")) | ||
| 64 | rw.Write([]byte("7. get memprof\n")) | ||
| 65 | rw.Write([]byte("8. gc summary\n")) | ||
| 57 | } | 66 | } |
| 58 | } | 67 | } |
| 59 | 68 | ... | ... |
| ... | @@ -6,7 +6,7 @@ import ( | ... | @@ -6,7 +6,7 @@ import ( |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | func TestGetUrl(t *testing.T) { | 8 | func TestGetUrl(t *testing.T) { |
| 9 | resp, err := Get("http://beego.me/").Response() | 9 | resp, err := Get("http://beego.me/").Debug(true).Response() |
| 10 | if err != nil { | 10 | if err != nil { |
| 11 | t.Fatal(err) | 11 | t.Fatal(err) |
| 12 | } | 12 | } | ... | ... |
| ... | @@ -87,8 +87,7 @@ func (c *ConnWriter) connect() error { | ... | @@ -87,8 +87,7 @@ func (c *ConnWriter) connect() error { |
| 87 | return err | 87 | return err |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | tcpConn, ok := conn.(*net.TCPConn) | 90 | if tcpConn, ok := conn.(*net.TCPConn); ok { |
| 91 | if ok { | ||
| 92 | tcpConn.SetKeepAlive(true) | 91 | tcpConn.SetKeepAlive(true) |
| 93 | } | 92 | } |
| 94 | 93 | ... | ... |
| ... | @@ -81,17 +81,21 @@ Writing a provider is easy. You only need to define two struct types | ... | @@ -81,17 +81,21 @@ Writing a provider is easy. You only need to define two struct types |
| 81 | Maybe you will find the **memory** provider as good example. | 81 | Maybe you will find the **memory** provider as good example. |
| 82 | 82 | ||
| 83 | type SessionStore interface { | 83 | type SessionStore interface { |
| 84 | Set(key, value interface{}) error // set session value | 84 | Set(key, value interface{}) error //set session value |
| 85 | Get(key interface{}) interface{} // get session value | 85 | Get(key interface{}) interface{} //get session value |
| 86 | Delete(key interface{}) error // delete session value | 86 | Delete(key interface{}) error //delete session value |
| 87 | SessionID() string // return current sessionID | 87 | SessionID() string //back current sessionID |
| 88 | SessionRelease() // release the resource | 88 | SessionRelease() // release the resource & save data to provider |
| 89 | Flush() error //delete all data | ||
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | type Provider interface { | 92 | type Provider interface { |
| 92 | SessionInit(maxlifetime int64, savePath string) error | 93 | SessionInit(maxlifetime int64, savePath string) error |
| 93 | SessionRead(sid string) (SessionStore, error) | 94 | SessionRead(sid string) (SessionStore, error) |
| 95 | SessionExist(sid string) bool | ||
| 96 | SessionRegenerate(oldsid, sid string) (SessionStore, error) | ||
| 94 | SessionDestroy(sid string) error | 97 | SessionDestroy(sid string) error |
| 98 | SessionAll() int //get all active session | ||
| 95 | SessionGC() | 99 | SessionGC() |
| 96 | } | 100 | } |
| 97 | 101 | ... | ... |
-
Please register or sign in to post a comment