func Load(id string) *TraceT { body, err := redis.Get(id) if err != nil { return nil } t := &TraceT{} if err := json.Unmarshal([]byte(body), t); err != nil { return nil } g_traceMgr.Set(t.ID, t) return t }
func GetUserState(uid uint64) (*UserState, error) { us := &UserState{Uid: uid} key := fmt.Sprintf("user_state_%v", us.Uid) val, err := redis_.Get(key) if err != nil { if errors.ERR_NO_DATA.Equal(err) { return us, nil } return us, errors.As(err, key) } if err := json.Unmarshal([]byte(val), us); err != nil { return us, errors.As(err, val) } return us, nil }
func GetUserToken(uid uint64) (string, error) { return redis.Get(fmt.Sprint(USER_TOKEN, uid)) }