i wanted to add full cahce but i dont have time :(

This commit is contained in:
gitGnome
2026-03-26 14:21:30 +01:00
parent ca0b85cdb7
commit 4ccaf627b4
3 changed files with 37 additions and 18 deletions
+20
View File
@@ -22,6 +22,26 @@ func CacheGetClientById(id uint32) (*Client, error) {
return client, nil
}
func CacheGetIdByName(name string) (uint32, error) {
client, err := CacheGetClientByName(name)
if err != nil {
return 0, err
}
return client.Id, nil
}
func CacheGetClientByName(name string) (*Client, error) {
mu.RLock()
defer mu.RUnlock()
for _, client := range CacheClients {
if client.Name == name {
return client, nil
}
}
return nil, fmt.Errorf("client %s not found", name)
}
func CacheSetClient(client *Client) {
mu.Lock()
defer mu.Unlock()