chore: format with csharpier
This commit is contained in:
parent
2f516dcb73
commit
4f54077c68
59 changed files with 2000 additions and 942 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue