mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	online cache
This commit is contained in:
		
							parent
							
								
									dcd874979e
								
							
						
					
					
						commit
						14aba3bb89
					
				@ -64,10 +64,6 @@ type OnlineCache struct {
 | 
				
			|||||||
	local lru.LRU[string, []int32]
 | 
						local lru.LRU[string, []int32]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (o *OnlineCache) getUserOnlineKey(userID string) string {
 | 
					 | 
				
			||||||
	return "<u>" + userID
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (o *OnlineCache) GetUserOnlinePlatform(ctx context.Context, userID string) ([]int32, error) {
 | 
					func (o *OnlineCache) GetUserOnlinePlatform(ctx context.Context, userID string) ([]int32, error) {
 | 
				
			||||||
	return o.local.Get(userID, func() ([]int32, error) {
 | 
						return o.local.Get(userID, func() ([]int32, error) {
 | 
				
			||||||
		return o.user.GetUserOnlinePlatform(ctx, userID)
 | 
							return o.user.GetUserOnlinePlatform(ctx, userID)
 | 
				
			||||||
@ -117,5 +113,5 @@ func (o *OnlineCache) GetGroupOnline(ctx context.Context, groupID string) ([]str
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (o *OnlineCache) setUserOnline(userID string, platformIDs []int32) bool {
 | 
					func (o *OnlineCache) setUserOnline(userID string, platformIDs []int32) bool {
 | 
				
			||||||
	return o.local.SetHas(o.getUserOnlineKey(userID), platformIDs)
 | 
						return o.local.SetHas(userID, platformIDs)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user