1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 18:10:54 +00:00

update some tips

This commit is contained in:
astaxie 2013-12-07 13:26:22 +08:00
parent 2220968a01
commit 48ad0202bf
4 changed files with 21 additions and 9 deletions

View File

@ -53,7 +53,16 @@ func ProfIndex(rw http.ResponseWriter, r *http.Request) {
if command != "" { if command != "" {
toolbox.ProcessInput(command, rw) toolbox.ProcessInput(command, rw)
} else { } 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"))
} }
} }

View File

@ -6,7 +6,7 @@ import (
) )
func TestGetUrl(t *testing.T) { func TestGetUrl(t *testing.T) {
resp, err := Get("http://beego.me/").Response() resp, err := Get("http://beego.me/").Debug(true).Response()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -87,8 +87,7 @@ func (c *ConnWriter) connect() error {
return err return err
} }
tcpConn, ok := conn.(*net.TCPConn) if tcpConn, ok := conn.(*net.TCPConn); ok {
if ok {
tcpConn.SetKeepAlive(true) tcpConn.SetKeepAlive(true)
} }

View File

@ -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. Maybe you will find the **memory** provider as good example.
type SessionStore interface { type SessionStore interface {
Set(key, value interface{}) error // set session value Set(key, value interface{}) error //set session value
Get(key interface{}) interface{} // get session value Get(key interface{}) interface{} //get session value
Delete(key interface{}) error // delete session value Delete(key interface{}) error //delete session value
SessionID() string // return current sessionID SessionID() string //back current sessionID
SessionRelease() // release the resource SessionRelease() // release the resource & save data to provider
Flush() error //delete all data
} }
type Provider interface { type Provider interface {
SessionInit(maxlifetime int64, savePath string) error SessionInit(maxlifetime int64, savePath string) error
SessionRead(sid string) (SessionStore, error) SessionRead(sid string) (SessionStore, error)
SessionExist(sid string) bool
SessionRegenerate(oldsid, sid string) (SessionStore, error)
SessionDestroy(sid string) error SessionDestroy(sid string) error
SessionAll() int //get all active session
SessionGC() SessionGC()
} }