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

clear code

This commit is contained in:
lcbluestorm 2016-05-20 10:27:18 +08:00
parent 6234b50111
commit 4890dd708c
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package ssdb
import (
"errors"
"net/http"
"strconv"
"strings"
@ -21,6 +22,9 @@ type SsdbProvider struct {
func (p *SsdbProvider) connectInit() error {
var err error
if p.host == "" || p.port == 0 {
return errors.New("SessionInit First")
}
p.client, err = ssdb.Connect(p.host, p.port)
if err != nil {
return err
@ -98,7 +102,6 @@ func (p *SsdbProvider) SessionRegenerate(oldsid, sid string) (session.Store, err
if value == nil || len(value.(string)) == 0 {
kv = make(map[interface{}]interface{})
} else {
var err error
kv, err = session.DecodeGob([]byte(value.(string)))
if err != nil {
return nil, err
@ -108,7 +111,7 @@ func (p *SsdbProvider) SessionRegenerate(oldsid, sid string) (session.Store, err
return nil, err
}
}
_, e := p.client.Do("setx", sid, value.(string), p.maxLifetime)
_, e := p.client.Do("setx", sid, value, p.maxLifetime)
if e != nil {
return nil, e
}

View File

@ -1,7 +1,6 @@
package ssdb
import (
"fmt"
"net/http"
"testing"
)
@ -55,6 +54,4 @@ func Test(t *testing.T) {
if p.SessionExist("1") {
t.Error("SessionExist err")
}
fmt.Println(newS)
}