68254416 by 傅小黑

add comments for session packages, part 2

1 parent 3f0ec5c0
...@@ -9,6 +9,8 @@ import ( ...@@ -9,6 +9,8 @@ import (
9 9
10 var mempder = &MemProvider{list: list.New(), sessions: make(map[string]*list.Element)} 10 var mempder = &MemProvider{list: list.New(), sessions: make(map[string]*list.Element)}
11 11
12 // memory session store.
13 // it saved sessions in a map in memory.
12 type MemSessionStore struct { 14 type MemSessionStore struct {
13 sid string //session id 15 sid string //session id
14 timeAccessed time.Time //last access time 16 timeAccessed time.Time //last access time
...@@ -16,6 +18,7 @@ type MemSessionStore struct { ...@@ -16,6 +18,7 @@ type MemSessionStore struct {
16 lock sync.RWMutex 18 lock sync.RWMutex
17 } 19 }
18 20
21 // set value to memory session
19 func (st *MemSessionStore) Set(key, value interface{}) error { 22 func (st *MemSessionStore) Set(key, value interface{}) error {
20 st.lock.Lock() 23 st.lock.Lock()
21 defer st.lock.Unlock() 24 defer st.lock.Unlock()
...@@ -23,6 +26,7 @@ func (st *MemSessionStore) Set(key, value interface{}) error { ...@@ -23,6 +26,7 @@ func (st *MemSessionStore) Set(key, value interface{}) error {
23 return nil 26 return nil
24 } 27 }
25 28
29 // get value from memory session by key
26 func (st *MemSessionStore) Get(key interface{}) interface{} { 30 func (st *MemSessionStore) Get(key interface{}) interface{} {
27 st.lock.RLock() 31 st.lock.RLock()
28 defer st.lock.RUnlock() 32 defer st.lock.RUnlock()
...@@ -34,6 +38,7 @@ func (st *MemSessionStore) Get(key interface{}) interface{} { ...@@ -34,6 +38,7 @@ func (st *MemSessionStore) Get(key interface{}) interface{} {
34 return nil 38 return nil
35 } 39 }
36 40
41 // delete in memory session by key
37 func (st *MemSessionStore) Delete(key interface{}) error { 42 func (st *MemSessionStore) Delete(key interface{}) error {
38 st.lock.Lock() 43 st.lock.Lock()
39 defer st.lock.Unlock() 44 defer st.lock.Unlock()
...@@ -41,6 +46,7 @@ func (st *MemSessionStore) Delete(key interface{}) error { ...@@ -41,6 +46,7 @@ func (st *MemSessionStore) Delete(key interface{}) error {
41 return nil 46 return nil
42 } 47 }
43 48
49 // clear all values in memory session
44 func (st *MemSessionStore) Flush() error { 50 func (st *MemSessionStore) Flush() error {
45 st.lock.Lock() 51 st.lock.Lock()
46 defer st.lock.Unlock() 52 defer st.lock.Unlock()
...@@ -48,27 +54,31 @@ func (st *MemSessionStore) Flush() error { ...@@ -48,27 +54,31 @@ func (st *MemSessionStore) Flush() error {
48 return nil 54 return nil
49 } 55 }
50 56
57 // get this id of memory session store
51 func (st *MemSessionStore) SessionID() string { 58 func (st *MemSessionStore) SessionID() string {
52 return st.sid 59 return st.sid
53 } 60 }
54 61
62 // Implement method, no used.
55 func (st *MemSessionStore) SessionRelease(w http.ResponseWriter) { 63 func (st *MemSessionStore) SessionRelease(w http.ResponseWriter) {
56 } 64 }
57 65
58 type MemProvider struct { 66 type MemProvider struct {
59 lock sync.RWMutex //用来锁 67 lock sync.RWMutex // locker
60 sessions map[string]*list.Element //用来存储在内存 68 sessions map[string]*list.Element // map in memory
61 list *list.List //用来做gc 69 list *list.List // for gc
62 maxlifetime int64 70 maxlifetime int64
63 savePath string 71 savePath string
64 } 72 }
65 73
74 // init memory session
66 func (pder *MemProvider) SessionInit(maxlifetime int64, savePath string) error { 75 func (pder *MemProvider) SessionInit(maxlifetime int64, savePath string) error {
67 pder.maxlifetime = maxlifetime 76 pder.maxlifetime = maxlifetime
68 pder.savePath = savePath 77 pder.savePath = savePath
69 return nil 78 return nil
70 } 79 }
71 80
81 // get memory session store by sid
72 func (pder *MemProvider) SessionRead(sid string) (SessionStore, error) { 82 func (pder *MemProvider) SessionRead(sid string) (SessionStore, error) {
73 pder.lock.RLock() 83 pder.lock.RLock()
74 if element, ok := pder.sessions[sid]; ok { 84 if element, ok := pder.sessions[sid]; ok {
...@@ -87,6 +97,7 @@ func (pder *MemProvider) SessionRead(sid string) (SessionStore, error) { ...@@ -87,6 +97,7 @@ func (pder *MemProvider) SessionRead(sid string) (SessionStore, error) {
87 return nil, nil 97 return nil, nil
88 } 98 }
89 99
100 // check session store exist in memory session by sid
90 func (pder *MemProvider) SessionExist(sid string) bool { 101 func (pder *MemProvider) SessionExist(sid string) bool {
91 pder.lock.RLock() 102 pder.lock.RLock()
92 defer pder.lock.RUnlock() 103 defer pder.lock.RUnlock()
...@@ -97,6 +108,7 @@ func (pder *MemProvider) SessionExist(sid string) bool { ...@@ -97,6 +108,7 @@ func (pder *MemProvider) SessionExist(sid string) bool {
97 } 108 }
98 } 109 }
99 110
111 // generate new sid for session store in memory session
100 func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) { 112 func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) {
101 pder.lock.RLock() 113 pder.lock.RLock()
102 if element, ok := pder.sessions[oldsid]; ok { 114 if element, ok := pder.sessions[oldsid]; ok {
...@@ -120,6 +132,7 @@ func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er ...@@ -120,6 +132,7 @@ func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er
120 return nil, nil 132 return nil, nil
121 } 133 }
122 134
135 // delete session store in memory session by id
123 func (pder *MemProvider) SessionDestroy(sid string) error { 136 func (pder *MemProvider) SessionDestroy(sid string) error {
124 pder.lock.Lock() 137 pder.lock.Lock()
125 defer pder.lock.Unlock() 138 defer pder.lock.Unlock()
...@@ -131,6 +144,7 @@ func (pder *MemProvider) SessionDestroy(sid string) error { ...@@ -131,6 +144,7 @@ func (pder *MemProvider) SessionDestroy(sid string) error {
131 return nil 144 return nil
132 } 145 }
133 146
147 // clean expired session stores in memory session
134 func (pder *MemProvider) SessionGC() { 148 func (pder *MemProvider) SessionGC() {
135 pder.lock.RLock() 149 pder.lock.RLock()
136 for { 150 for {
...@@ -152,10 +166,12 @@ func (pder *MemProvider) SessionGC() { ...@@ -152,10 +166,12 @@ func (pder *MemProvider) SessionGC() {
152 pder.lock.RUnlock() 166 pder.lock.RUnlock()
153 } 167 }
154 168
169 // get count number of memory session
155 func (pder *MemProvider) SessionAll() int { 170 func (pder *MemProvider) SessionAll() int {
156 return pder.list.Len() 171 return pder.list.Len()
157 } 172 }
158 173
174 // expand time of session store by id in memory session
159 func (pder *MemProvider) SessionUpdate(sid string) error { 175 func (pder *MemProvider) SessionUpdate(sid string) error {
160 pder.lock.Lock() 176 pder.lock.Lock()
161 defer pder.lock.Unlock() 177 defer pder.lock.Unlock()
......
1 package session 1 package session
2 2
3 //CREATE TABLE `session` ( 3 // mysql session support need create table as sql:
4 // `session_key` char(64) NOT NULL, 4 // CREATE TABLE `session` (
5 // `session_data` blob, 5 // `session_key` char(64) NOT NULL,
6 // `session_expiry` int(11) unsigned NOT NULL, 6 // session_data` blob,
7 // PRIMARY KEY (`session_key`) 7 // `session_expiry` int(11) unsigned NOT NULL,
8 //) ENGINE=MyISAM DEFAULT CHARSET=utf8; 8 // PRIMARY KEY (`session_key`)
9 // ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
9 10
10 import ( 11 import (
11 "database/sql" 12 "database/sql"
...@@ -18,6 +19,7 @@ import ( ...@@ -18,6 +19,7 @@ import (
18 19
19 var mysqlpder = &MysqlProvider{} 20 var mysqlpder = &MysqlProvider{}
20 21
22 // mysql session store
21 type MysqlSessionStore struct { 23 type MysqlSessionStore struct {
22 c *sql.DB 24 c *sql.DB
23 sid string 25 sid string
...@@ -25,6 +27,8 @@ type MysqlSessionStore struct { ...@@ -25,6 +27,8 @@ type MysqlSessionStore struct {
25 values map[interface{}]interface{} 27 values map[interface{}]interface{}
26 } 28 }
27 29
30 // set value in mysql session.
31 // it is temp value in map.
28 func (st *MysqlSessionStore) Set(key, value interface{}) error { 32 func (st *MysqlSessionStore) Set(key, value interface{}) error {
29 st.lock.Lock() 33 st.lock.Lock()
30 defer st.lock.Unlock() 34 defer st.lock.Unlock()
...@@ -32,6 +36,7 @@ func (st *MysqlSessionStore) Set(key, value interface{}) error { ...@@ -32,6 +36,7 @@ func (st *MysqlSessionStore) Set(key, value interface{}) error {
32 return nil 36 return nil
33 } 37 }
34 38
39 // get value from mysql session
35 func (st *MysqlSessionStore) Get(key interface{}) interface{} { 40 func (st *MysqlSessionStore) Get(key interface{}) interface{} {
36 st.lock.RLock() 41 st.lock.RLock()
37 defer st.lock.RUnlock() 42 defer st.lock.RUnlock()
...@@ -43,6 +48,7 @@ func (st *MysqlSessionStore) Get(key interface{}) interface{} { ...@@ -43,6 +48,7 @@ func (st *MysqlSessionStore) Get(key interface{}) interface{} {
43 return nil 48 return nil
44 } 49 }
45 50
51 // delete value in mysql session
46 func (st *MysqlSessionStore) Delete(key interface{}) error { 52 func (st *MysqlSessionStore) Delete(key interface{}) error {
47 st.lock.Lock() 53 st.lock.Lock()
48 defer st.lock.Unlock() 54 defer st.lock.Unlock()
...@@ -50,6 +56,7 @@ func (st *MysqlSessionStore) Delete(key interface{}) error { ...@@ -50,6 +56,7 @@ func (st *MysqlSessionStore) Delete(key interface{}) error {
50 return nil 56 return nil
51 } 57 }
52 58
59 // clear all values in mysql session
53 func (st *MysqlSessionStore) Flush() error { 60 func (st *MysqlSessionStore) Flush() error {
54 st.lock.Lock() 61 st.lock.Lock()
55 defer st.lock.Unlock() 62 defer st.lock.Unlock()
...@@ -57,10 +64,13 @@ func (st *MysqlSessionStore) Flush() error { ...@@ -57,10 +64,13 @@ func (st *MysqlSessionStore) Flush() error {
57 return nil 64 return nil
58 } 65 }
59 66
67 // get session id of this mysql session store
60 func (st *MysqlSessionStore) SessionID() string { 68 func (st *MysqlSessionStore) SessionID() string {
61 return st.sid 69 return st.sid
62 } 70 }
63 71
72 // save mysql session values to database.
73 // must call this method to save values to database.
64 func (st *MysqlSessionStore) SessionRelease(w http.ResponseWriter) { 74 func (st *MysqlSessionStore) SessionRelease(w http.ResponseWriter) {
65 defer st.c.Close() 75 defer st.c.Close()
66 b, err := encodeGob(st.values) 76 b, err := encodeGob(st.values)
...@@ -72,11 +82,13 @@ func (st *MysqlSessionStore) SessionRelease(w http.ResponseWriter) { ...@@ -72,11 +82,13 @@ func (st *MysqlSessionStore) SessionRelease(w http.ResponseWriter) {
72 82
73 } 83 }
74 84
85 // mysql session provider
75 type MysqlProvider struct { 86 type MysqlProvider struct {
76 maxlifetime int64 87 maxlifetime int64
77 savePath string 88 savePath string
78 } 89 }
79 90
91 // connect to mysql
80 func (mp *MysqlProvider) connectInit() *sql.DB { 92 func (mp *MysqlProvider) connectInit() *sql.DB {
81 db, e := sql.Open("mysql", mp.savePath) 93 db, e := sql.Open("mysql", mp.savePath)
82 if e != nil { 94 if e != nil {
...@@ -85,12 +97,15 @@ func (mp *MysqlProvider) connectInit() *sql.DB { ...@@ -85,12 +97,15 @@ func (mp *MysqlProvider) connectInit() *sql.DB {
85 return db 97 return db
86 } 98 }
87 99
100 // init mysql session.
101 // savepath is the connection string of mysql.
88 func (mp *MysqlProvider) SessionInit(maxlifetime int64, savePath string) error { 102 func (mp *MysqlProvider) SessionInit(maxlifetime int64, savePath string) error {
89 mp.maxlifetime = maxlifetime 103 mp.maxlifetime = maxlifetime
90 mp.savePath = savePath 104 mp.savePath = savePath
91 return nil 105 return nil
92 } 106 }
93 107
108 // get mysql session by sid
94 func (mp *MysqlProvider) SessionRead(sid string) (SessionStore, error) { 109 func (mp *MysqlProvider) SessionRead(sid string) (SessionStore, error) {
95 c := mp.connectInit() 110 c := mp.connectInit()
96 row := c.QueryRow("select session_data from session where session_key=?", sid) 111 row := c.QueryRow("select session_data from session where session_key=?", sid)
...@@ -113,6 +128,7 @@ func (mp *MysqlProvider) SessionRead(sid string) (SessionStore, error) { ...@@ -113,6 +128,7 @@ func (mp *MysqlProvider) SessionRead(sid string) (SessionStore, error) {
113 return rs, nil 128 return rs, nil
114 } 129 }
115 130
131 // check mysql session exist
116 func (mp *MysqlProvider) SessionExist(sid string) bool { 132 func (mp *MysqlProvider) SessionExist(sid string) bool {
117 c := mp.connectInit() 133 c := mp.connectInit()
118 defer c.Close() 134 defer c.Close()
...@@ -126,6 +142,7 @@ func (mp *MysqlProvider) SessionExist(sid string) bool { ...@@ -126,6 +142,7 @@ func (mp *MysqlProvider) SessionExist(sid string) bool {
126 } 142 }
127 } 143 }
128 144
145 // generate new sid for mysql session
129 func (mp *MysqlProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) { 146 func (mp *MysqlProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) {
130 c := mp.connectInit() 147 c := mp.connectInit()
131 row := c.QueryRow("select session_data from session where session_key=?", oldsid) 148 row := c.QueryRow("select session_data from session where session_key=?", oldsid)
...@@ -148,6 +165,7 @@ func (mp *MysqlProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er ...@@ -148,6 +165,7 @@ func (mp *MysqlProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er
148 return rs, nil 165 return rs, nil
149 } 166 }
150 167
168 // delete mysql session by sid
151 func (mp *MysqlProvider) SessionDestroy(sid string) error { 169 func (mp *MysqlProvider) SessionDestroy(sid string) error {
152 c := mp.connectInit() 170 c := mp.connectInit()
153 c.Exec("DELETE FROM session where session_key=?", sid) 171 c.Exec("DELETE FROM session where session_key=?", sid)
...@@ -155,6 +173,7 @@ func (mp *MysqlProvider) SessionDestroy(sid string) error { ...@@ -155,6 +173,7 @@ func (mp *MysqlProvider) SessionDestroy(sid string) error {
155 return nil 173 return nil
156 } 174 }
157 175
176 // delete expired values in mysql session
158 func (mp *MysqlProvider) SessionGC() { 177 func (mp *MysqlProvider) SessionGC() {
159 c := mp.connectInit() 178 c := mp.connectInit()
160 c.Exec("DELETE from session where session_expiry < ?", time.Now().Unix()-mp.maxlifetime) 179 c.Exec("DELETE from session where session_expiry < ?", time.Now().Unix()-mp.maxlifetime)
...@@ -162,6 +181,7 @@ func (mp *MysqlProvider) SessionGC() { ...@@ -162,6 +181,7 @@ func (mp *MysqlProvider) SessionGC() {
162 return 181 return
163 } 182 }
164 183
184 // count values in mysql session
165 func (mp *MysqlProvider) SessionAll() int { 185 func (mp *MysqlProvider) SessionAll() int {
166 c := mp.connectInit() 186 c := mp.connectInit()
167 defer c.Close() 187 defer c.Close()
......
...@@ -11,10 +11,12 @@ import ( ...@@ -11,10 +11,12 @@ import (
11 11
12 var redispder = &RedisProvider{} 12 var redispder = &RedisProvider{}
13 13
14 // redis max pool size
14 var MAX_POOL_SIZE = 100 15 var MAX_POOL_SIZE = 100
15 16
16 var redisPool chan redis.Conn 17 var redisPool chan redis.Conn
17 18
19 // redis session store
18 type RedisSessionStore struct { 20 type RedisSessionStore struct {
19 p *redis.Pool 21 p *redis.Pool
20 sid string 22 sid string
...@@ -23,6 +25,7 @@ type RedisSessionStore struct { ...@@ -23,6 +25,7 @@ type RedisSessionStore struct {
23 maxlifetime int64 25 maxlifetime int64
24 } 26 }
25 27
28 // set value in redis session
26 func (rs *RedisSessionStore) Set(key, value interface{}) error { 29 func (rs *RedisSessionStore) Set(key, value interface{}) error {
27 rs.lock.Lock() 30 rs.lock.Lock()
28 defer rs.lock.Unlock() 31 defer rs.lock.Unlock()
...@@ -30,6 +33,7 @@ func (rs *RedisSessionStore) Set(key, value interface{}) error { ...@@ -30,6 +33,7 @@ func (rs *RedisSessionStore) Set(key, value interface{}) error {
30 return nil 33 return nil
31 } 34 }
32 35
36 // get value in redis session
33 func (rs *RedisSessionStore) Get(key interface{}) interface{} { 37 func (rs *RedisSessionStore) Get(key interface{}) interface{} {
34 rs.lock.RLock() 38 rs.lock.RLock()
35 defer rs.lock.RUnlock() 39 defer rs.lock.RUnlock()
...@@ -41,6 +45,7 @@ func (rs *RedisSessionStore) Get(key interface{}) interface{} { ...@@ -41,6 +45,7 @@ func (rs *RedisSessionStore) Get(key interface{}) interface{} {
41 return nil 45 return nil
42 } 46 }
43 47
48 // delete value in redis session
44 func (rs *RedisSessionStore) Delete(key interface{}) error { 49 func (rs *RedisSessionStore) Delete(key interface{}) error {
45 rs.lock.Lock() 50 rs.lock.Lock()
46 defer rs.lock.Unlock() 51 defer rs.lock.Unlock()
...@@ -48,6 +53,7 @@ func (rs *RedisSessionStore) Delete(key interface{}) error { ...@@ -48,6 +53,7 @@ func (rs *RedisSessionStore) Delete(key interface{}) error {
48 return nil 53 return nil
49 } 54 }
50 55
56 // clear all values in redis session
51 func (rs *RedisSessionStore) Flush() error { 57 func (rs *RedisSessionStore) Flush() error {
52 rs.lock.Lock() 58 rs.lock.Lock()
53 defer rs.lock.Unlock() 59 defer rs.lock.Unlock()
...@@ -55,10 +61,12 @@ func (rs *RedisSessionStore) Flush() error { ...@@ -55,10 +61,12 @@ func (rs *RedisSessionStore) Flush() error {
55 return nil 61 return nil
56 } 62 }
57 63
64 // get redis session id
58 func (rs *RedisSessionStore) SessionID() string { 65 func (rs *RedisSessionStore) SessionID() string {
59 return rs.sid 66 return rs.sid
60 } 67 }
61 68
69 // save session values to redis
62 func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { 70 func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
63 c := rs.p.Get() 71 c := rs.p.Get()
64 defer c.Close() 72 defer c.Close()
...@@ -77,6 +85,7 @@ func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { ...@@ -77,6 +85,7 @@ func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
77 c.Do("SET", rs.sid, string(b), "EX", rs.maxlifetime) 85 c.Do("SET", rs.sid, string(b), "EX", rs.maxlifetime)
78 } 86 }
79 87
88 // redis session provider
80 type RedisProvider struct { 89 type RedisProvider struct {
81 maxlifetime int64 90 maxlifetime int64
82 savePath string 91 savePath string
...@@ -85,8 +94,9 @@ type RedisProvider struct { ...@@ -85,8 +94,9 @@ type RedisProvider struct {
85 poollist *redis.Pool 94 poollist *redis.Pool
86 } 95 }
87 96
88 //savepath like redisserveraddr,poolsize,password 97 // init redis session
89 //127.0.0.1:6379,100,astaxie 98 // savepath like redis server addr,pool size,password
99 // e.g. 127.0.0.1:6379,100,astaxie
90 func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error { 100 func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error {
91 rp.maxlifetime = maxlifetime 101 rp.maxlifetime = maxlifetime
92 configs := strings.Split(savePath, ",") 102 configs := strings.Split(savePath, ",")
...@@ -122,6 +132,7 @@ func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error { ...@@ -122,6 +132,7 @@ func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error {
122 return nil 132 return nil
123 } 133 }
124 134
135 // read redis session by sid
125 func (rp *RedisProvider) SessionRead(sid string) (SessionStore, error) { 136 func (rp *RedisProvider) SessionRead(sid string) (SessionStore, error) {
126 c := rp.poollist.Get() 137 c := rp.poollist.Get()
127 defer c.Close() 138 defer c.Close()
...@@ -141,6 +152,7 @@ func (rp *RedisProvider) SessionRead(sid string) (SessionStore, error) { ...@@ -141,6 +152,7 @@ func (rp *RedisProvider) SessionRead(sid string) (SessionStore, error) {
141 return rs, nil 152 return rs, nil
142 } 153 }
143 154
155 // check redis session exist by sid
144 func (rp *RedisProvider) SessionExist(sid string) bool { 156 func (rp *RedisProvider) SessionExist(sid string) bool {
145 c := rp.poollist.Get() 157 c := rp.poollist.Get()
146 defer c.Close() 158 defer c.Close()
...@@ -152,6 +164,7 @@ func (rp *RedisProvider) SessionExist(sid string) bool { ...@@ -152,6 +164,7 @@ func (rp *RedisProvider) SessionExist(sid string) bool {
152 } 164 }
153 } 165 }
154 166
167 // generate new sid for redis session
155 func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) { 168 func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (SessionStore, error) {
156 c := rp.poollist.Get() 169 c := rp.poollist.Get()
157 defer c.Close() 170 defer c.Close()
...@@ -181,6 +194,7 @@ func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er ...@@ -181,6 +194,7 @@ func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er
181 return rs, nil 194 return rs, nil
182 } 195 }
183 196
197 // delete redis session by id
184 func (rp *RedisProvider) SessionDestroy(sid string) error { 198 func (rp *RedisProvider) SessionDestroy(sid string) error {
185 c := rp.poollist.Get() 199 c := rp.poollist.Get()
186 defer c.Close() 200 defer c.Close()
...@@ -189,11 +203,12 @@ func (rp *RedisProvider) SessionDestroy(sid string) error { ...@@ -189,11 +203,12 @@ func (rp *RedisProvider) SessionDestroy(sid string) error {
189 return nil 203 return nil
190 } 204 }
191 205
206 // Impelment method, no used.
192 func (rp *RedisProvider) SessionGC() { 207 func (rp *RedisProvider) SessionGC() {
193 return 208 return
194 } 209 }
195 210
196 //@todo 211 // @todo
197 func (rp *RedisProvider) SessionAll() int { 212 func (rp *RedisProvider) SessionAll() int {
198 return 0 213 return 0
199 } 214 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!