func NewSession(username string) *Session { return &Session{ Username: username, SessionId: uint(sessionIdGen.Next()), Expire: time.Now().Add(time.Duration(option.Int("sessionlife")) * time.Second), } }
func Run() { d := time.Duration(option.Int("refresh")) * time.Millisecond for range time.Tick(d) { for _, universe := range save.Multiverse { universe.Update(d) } } }
func (s *Session) Refresh() { s.Expire = time.Now().Add(time.Duration(option.Int("sessionlife")) * time.Second) }