diff options
Diffstat (limited to 'telegram/cache')
-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() |