func User(id int) (entities.User, error) { var err error var user entities.User var userKey = constants.USER_KEY + string(id) err = utils.Get(userKey, &user) fmt.Println("************err:", err, "user:"******"user").Filter("id", id).One(&user, "id", "nick", "age", "cell", "mail", "sex", "CreatedAt", "UpdatedAt") if err == nil { utils.Set(userKey, user, 1000) } return user, err }
func TestSet(t *testing.T) { err := utils.Set("aa", "aa", 10) fmt.Print("val:", err) }