feat: add channel create responder and redis webhook cache
This commit is contained in:
parent
99c1587e7b
commit
e86b37ce2a
11 changed files with 201 additions and 10 deletions
15
Catalogger.Backend/Services/RedisWebhookCache.cs
Normal file
15
Catalogger.Backend/Services/RedisWebhookCache.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using Catalogger.Backend.Database.Redis;
|
||||
using Humanizer;
|
||||
|
||||
namespace Catalogger.Backend.Services;
|
||||
|
||||
public class RedisWebhookCache(RedisService redisService) : IWebhookCache
|
||||
{
|
||||
public async Task<Webhook?> GetWebhookAsync(ulong channelId) =>
|
||||
await redisService.GetAsync<Webhook?>(WebhookKey(channelId));
|
||||
|
||||
public async Task SetWebhookAsync(ulong channelId, Webhook webhook) =>
|
||||
await redisService.SetAsync(WebhookKey(channelId), webhook, 24.Hours());
|
||||
|
||||
private static string WebhookKey(ulong channelId) => $"webhook:{channelId}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue