2017-09-13 01:12:40 +00:00
|
|
|
|
using StackExchange.Redis;
|
2017-10-26 09:31:44 +00:00
|
|
|
|
using System;
|
2017-09-12 20:27:51 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2017-10-13 04:14:54 +00:00
|
|
|
|
namespace NadekoBot.Core.Services
|
2017-09-12 20:27:51 +00:00
|
|
|
|
{
|
|
|
|
|
public interface IDataCache
|
|
|
|
|
{
|
2017-09-13 01:12:40 +00:00
|
|
|
|
ConnectionMultiplexer Redis { get; }
|
2017-11-05 12:28:08 +00:00
|
|
|
|
IImageCache LocalImages { get; }
|
2017-11-06 09:01:38 +00:00
|
|
|
|
ILocalDataCache LocalData { get; }
|
2017-11-05 12:28:08 +00:00
|
|
|
|
|
2017-09-12 20:27:51 +00:00
|
|
|
|
Task<(bool Success, byte[] Data)> TryGetImageDataAsync(string key);
|
2017-09-15 00:42:51 +00:00
|
|
|
|
Task<(bool Success, string Data)> TryGetAnimeDataAsync(string key);
|
2017-11-02 17:22:17 +00:00
|
|
|
|
Task<(bool Success, string Data)> TryGetNovelDataAsync(string key);
|
2017-09-12 20:27:51 +00:00
|
|
|
|
Task SetImageDataAsync(string key, byte[] data);
|
2017-09-15 00:42:51 +00:00
|
|
|
|
Task SetAnimeDataAsync(string link, string data);
|
2017-11-02 17:22:17 +00:00
|
|
|
|
Task SetNovelDataAsync(string link, string data);
|
2017-10-26 09:31:44 +00:00
|
|
|
|
TimeSpan? AddTimelyClaim(ulong id, int period);
|
2017-10-26 11:03:53 +00:00
|
|
|
|
void RemoveAllTimelyClaims();
|
2017-11-03 11:35:27 +00:00
|
|
|
|
bool TryAddAffinityCooldown(ulong userId, out TimeSpan? time);
|
2017-11-03 11:46:51 +00:00
|
|
|
|
bool TryAddDivorceCooldown(ulong userId, out TimeSpan? time);
|
2017-09-12 20:27:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|