chore: format with csharpier

This commit is contained in:
sam 2024-10-09 17:35:11 +02:00
parent 2f516dcb73
commit 4f54077c68
59 changed files with 2000 additions and 942 deletions

View file

@ -13,13 +13,16 @@ public class UserCache(IDiscordRestUserAPI userApi)
public int Size => _cacheSize;
public async Task<IUser?> GetUserAsync(Snowflake userId) => await _cache.GetOrAddAsync(userId.ToString(),
async () =>
{
var user = await userApi.GetUserAsync(userId).GetOrThrow();
Interlocked.Increment(ref _cacheSize);
return user;
});
public async Task<IUser?> GetUserAsync(Snowflake userId) =>
await _cache.GetOrAddAsync(
userId.ToString(),
async () =>
{
var user = await userApi.GetUserAsync(userId).GetOrThrow();
Interlocked.Increment(ref _cacheSize);
return user;
}
);
public void UpdateUser(IUser user) => _cache.Add(user.ID.ToString(), user);
}
}