diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2021-12-04 21:10:54 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2021-12-04 21:10:54 +0300 |
commit | 105f5017c35f92a9e2f5398a06cfdd3f1da31bad (patch) | |
tree | c602c7eb3ede37718894e7dea7875490cbc8d728 /telegram/cache/cache.go | |
parent | bc37cf0c4f0d58752f92238a013513be9aa3caff (diff) |
Migrate to TDlib 1.7.9
Diffstat (limited to 'telegram/cache/cache.go')
-rw-r--r-- | telegram/cache/cache.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/telegram/cache/cache.go b/telegram/cache/cache.go index b799709..3d9608d 100644 --- a/telegram/cache/cache.go +++ b/telegram/cache/cache.go @@ -17,7 +17,7 @@ type Status struct { // a thread-safe manner type Cache struct { chats map[int64]*client.Chat - users map[int32]*client.User + users map[int64]*client.User statuses map[int64]*Status chatsLock sync.Mutex usersLock sync.Mutex @@ -28,7 +28,7 @@ type Cache struct { func NewCache() *Cache { return &Cache{ chats: map[int64]*client.Chat{}, - users: map[int32]*client.User{}, + users: map[int64]*client.User{}, statuses: map[int64]*Status{}, } } @@ -48,11 +48,11 @@ func (cache *Cache) ChatsKeys() []int64 { // UsersKeys grabs user ids synchronously to avoid lockups // while they are used -func (cache *Cache) UsersKeys() []int32 { +func (cache *Cache) UsersKeys() []int64 { cache.usersLock.Lock() defer cache.usersLock.Unlock() - var keys []int32 + var keys []int64 for id := range cache.users { keys = append(keys, id) } @@ -89,7 +89,7 @@ func (cache *Cache) GetChat(id int64) (*client.Chat, bool) { } // GetUser retrieves user by id if it's present in the cache -func (cache *Cache) GetUser(id int32) (*client.User, bool) { +func (cache *Cache) GetUser(id int64) (*client.User, bool) { cache.usersLock.Lock() defer cache.usersLock.Unlock() @@ -115,7 +115,7 @@ func (cache *Cache) SetChat(id int64, chat *client.Chat) { } // SetUser stores a user in the cache -func (cache *Cache) SetUser(id int32, user *client.User) { +func (cache *Cache) SetUser(id int64, user *client.User) { cache.usersLock.Lock() defer cache.usersLock.Unlock() |