ad group logic except somes
This commit is contained in:
@@ -22,11 +22,11 @@ func CacheGetClientById(id uint32) (*Client, error) {
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func CacheSetClient(id uint32, client *Client) {
|
||||
func CacheSetClient(client *Client) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
CacheClients[id] = client
|
||||
CacheClients[client.Id] = client
|
||||
}
|
||||
|
||||
func CacheDeleteClient(id uint32) {
|
||||
@@ -35,3 +35,17 @@ func CacheDeleteClient(id uint32) {
|
||||
|
||||
delete(CacheClients, id)
|
||||
}
|
||||
|
||||
func CacheSetGroup() {}
|
||||
|
||||
func CacheGetGroup(id uint32) (*Group, error) {
|
||||
mu.RLock()
|
||||
defer mu.RUnlock()
|
||||
|
||||
group, ok := Groups[id]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("group %d not found", id)
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user