mirror of
https://github.com/astaxie/beego.git
synced 2025-06-21 05:10:18 +00:00
Add error to SessionExist interface
Implement changed interface for all default providers as well and change tests accordingly
This commit is contained in:
@ -149,16 +149,16 @@ func (rp *MemProvider) SessionRead(sid string) (session.Store, error) {
|
||||
}
|
||||
|
||||
// SessionExist check memcache session exist by sid
|
||||
func (rp *MemProvider) SessionExist(sid string) bool {
|
||||
func (rp *MemProvider) SessionExist(sid string) (bool, error) {
|
||||
if client == nil {
|
||||
if err := rp.connectInit(); err != nil {
|
||||
return false
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
if item, err := client.Get(sid); err != nil || len(item.Value) == 0 {
|
||||
return false
|
||||
return false, err
|
||||
}
|
||||
return true
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// SessionRegenerate generate new sid for memcache session
|
||||
|
Reference in New Issue
Block a user