This commit is contained in:
parent
55121656a8
commit
48e1dbf8aa
|
@ -231,10 +231,13 @@ type AuthorProfile struct {
|
||||||
// and assigns the JSON string to the provided user's ID.
|
// and assigns the JSON string to the provided user's ID.
|
||||||
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||||
// Получаем ID автора из Redis
|
// Получаем ID автора из Redis
|
||||||
authorIdString, err := c.store.Get(c.ctx, fmt.Sprintf("author:user:%s", userId)).Result()
|
rkey := fmt.Sprintf("author:user:%s", userId)
|
||||||
|
fmt.Println("get redis cached by key:", rkey)
|
||||||
|
authorIdString, err := c.store.Get(c.ctx, rkey).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
fmt.Println("redis found string value:", authorIdString)
|
||||||
|
|
||||||
// Преобразуем ID автора из строки в int
|
// Преобразуем ID автора из строки в int
|
||||||
var authorIdFloat float64
|
var authorIdFloat float64
|
||||||
|
@ -243,6 +246,7 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
authorId := int(authorIdFloat)
|
authorId := int(authorIdFloat)
|
||||||
|
fmt.Println("recognized author id: ", authorId)
|
||||||
|
|
||||||
// Получаем профиль автора из Redis
|
// Получаем профиль автора из Redis
|
||||||
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf("author:id:%d", authorId)).Result()
|
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf("author:id:%d", authorId)).Result()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user