javaee论坛

普通会员

225648

帖子

355

回复

369

积分

楼主
发表于 2017-09-27 15:46:06 | 查看: 308 | 回复: 1
单个的Session:

package memoryproviderimport (    "time")type SessionStore struct {    sid          string                      // unique session id    timeAccessed time.Time                   // last access time    infoColl     map[interface{}]interface{} // session value stored inside}func (st *SessionStore) Set(key, value interface{}) error {    st.infoColl[key] = value    providerInstance().SessionUpdate(st.sid)    return nil}func (st *SessionStore) Get(key interface{}) interface{} {    providerInstance().SessionUpdate(st.sid)    if v, ok := st.infoColl[key]; ok {        return v    } else {        return nil    }    return nil}func (st *SessionStore) Delete(key interface{}) error {    delete(st.infoColl, key)    providerInstance().SessionUpdate(st.sid)    return nil}func (st *SessionStore) SessionID() string {    return st.sid}

上一篇:cookie管理(1) 下一篇:httputils的应用

普通会员

0

帖子

344

回复

352

积分
沙发
发表于 2023-08-24 23:53:15

爱你呦

您需要登录后才可以回帖 登录 | 立即注册

触屏版| 电脑版

技术支持 历史网 V2.0 © 2016-2017