We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 72d959b commit 338e5c4Copy full SHA for 338e5c4
zh/06.2.md
@@ -217,8 +217,7 @@ func init() {
217
func (manager *Manager) GC() {
218
manager.lock.Lock()
219
defer manager.lock.Unlock()
220
- manager.provider.SessionGC(manager.maxLifeTime)
221
- time.AfterFunc(time.Duration(manager.maxLifeTime), func() { manager.GC() })
+ time.AfterFunc(time.Duration(manager.maxLifeTime), func() { manager.provider.SessionGC(manager.maxLifeTime) })
222
}
223
```
224
我们可以看到GC充分利用了time包中的定时器功能,当超时`maxLifeTime`之后调用GC函数,这样就可以保证`maxLifeTime`时间内的session都是可用的,类似的方案也可以用于统计在线用户数之类的。
0 commit comments