feat(session): support v1
support v1
This commit is contained in:
@@ -7,8 +7,9 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/beego/beego/session"
|
||||
"github.com/ssdb/gossdb/ssdb"
|
||||
|
||||
"github.com/beego/beego/session"
|
||||
)
|
||||
|
||||
var ssdbProvider = &Provider{}
|
||||
@@ -67,7 +68,7 @@ func (p *Provider) SessionRead(sid string) (session.Store, error) {
|
||||
return rs, nil
|
||||
}
|
||||
|
||||
// SessionExist judged whether sid is exist in session
|
||||
// SessionExist judged whether sid is existed in session
|
||||
func (p *Provider) SessionExist(sid string) bool {
|
||||
if p.client == nil {
|
||||
if err := p.connectInit(); err != nil {
|
||||
@@ -194,6 +195,12 @@ func (s *SessionStore) SessionRelease(w http.ResponseWriter) {
|
||||
s.client.Do("setx", s.sid, string(b), s.maxLifetime)
|
||||
}
|
||||
|
||||
// SessionReleaseIfPresent is not supported now
|
||||
// Because ssdb does not support lua script or SETXX command
|
||||
func (s *SessionStore) SessionReleaseIfPresent(w http.ResponseWriter) {
|
||||
s.SessionRelease(w)
|
||||
}
|
||||
|
||||
func init() {
|
||||
session.Register("ssdb", ssdbProvider)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user