diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-05 00:47:44 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-05 00:47:44 +0300 |
commit | 8cd6387552dc9b73c60950e8c1a47c84ae13f98b (patch) | |
tree | b3ea81add8cbac8fee2a5153f792cdf217a65d10 /telegram/utils.go | |
parent | fa841bfa8bc0941e0416608e78308401c9334ae9 (diff) |
Make chats/users cache private
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 13c81d5..a708c28 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -58,7 +58,7 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli if id <= math.MaxInt32 && id >= math.MinInt32 { userID := int32(id) - user, ok = cache.users[userID] + user, ok = c.cache.users[userID] if !ok && userID > 0 { user, err = c.client.GetUser(&client.GetUserRequest{ UserId: userID, @@ -67,11 +67,11 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli return nil, nil, err } - cache.users[userID] = user + c.cache.users[userID] = user } } - cacheChat, ok = cache.chats[id] + cacheChat, ok = c.cache.chats[id] if !ok { if chat == nil { cacheChat, err = c.client.GetChat(&client.GetChatRequest{ @@ -81,9 +81,9 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli return nil, nil, err } - cache.chats[id] = cacheChat + c.cache.chats[id] = cacheChat } else { - cache.chats[id] = chat + c.cache.chats[id] = chat } } if chat == nil { |