move classes around, name caches more consistently, add more caches
This commit is contained in:
parent
e86b37ce2a
commit
e17dcf90a1
30 changed files with 443 additions and 51 deletions
|
|
@ -0,0 +1,20 @@
|
|||
using System.Collections.Concurrent;
|
||||
using Remora.Discord.API.Abstractions.Objects;
|
||||
using Remora.Rest.Core;
|
||||
|
||||
namespace Catalogger.Backend.Cache.InMemoryCache;
|
||||
|
||||
public class InMemoryInviteCache : IInviteCache
|
||||
{
|
||||
private readonly ConcurrentDictionary<Snowflake, IEnumerable<IInvite>> _invites = new();
|
||||
|
||||
public Task<IEnumerable<IInvite>> TryGetAsync(Snowflake guildId) => _invites.TryGetValue(guildId, out var invites)
|
||||
? Task.FromResult(invites)
|
||||
: Task.FromResult<IEnumerable<IInvite>>([]);
|
||||
|
||||
public Task SetAsync(Snowflake guildId, IEnumerable<IInvite> invites)
|
||||
{
|
||||
_invites[guildId] = invites;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue