mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Initial KV API concept
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Option;
|
||||
|
||||
/// <summary>
|
||||
/// Implements an interaction with storage for options.
|
||||
/// </summary>
|
||||
public interface IOptionStorageAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads a saved value (if exists) from storage.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public Task<byte[]?> LoadValueAsync(IOptionKey key);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a passed value to storage.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique chat key</param>
|
||||
/// <param name="value">The serialized value for saving</param>
|
||||
/// <returns></returns>
|
||||
public Task SaveValueAsync(IOptionKey key, byte[] value);
|
||||
}
|
||||
Reference in New Issue
Block a user