microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Common/Storage/Storage.cs
26lines · modeblame
82a4e3c3Rajan12 months ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. | |
| 3 | | |
73e7847aAlex Acebo1 years ago | 4 | namespace Microsoft.Teams.Common.Storage; |
| 5 | | |
| 6 | /// <summary> | |
| 7 | /// a storage container that can get/set/delete items by a unique key | |
| 8 | /// </summary> | |
| 9 | /// <typeparam name="TKey">the key type</typeparam> | |
| 10 | /// <typeparam name="TValue">the value type</typeparam> | |
| 11 | public interface IStorage<TKey, TValue> where TKey : notnull | |
| 12 | { | |
| 13 | public bool Exists(TKey key); | |
| 14 | public Task<bool> ExistsAsync(TKey key); | |
| 15 | | |
| 16 | public TValue? Get(TKey key); | |
| 17 | public T? Get<T>(TKey key) where T : TValue; | |
| 18 | public Task<TValue?> GetAsync(TKey key); | |
| 19 | public Task<T?> GetAsync<T>(TKey key) where T : TValue; | |
| 20 | | |
| 21 | public void Set(TKey key, TValue value); | |
| 22 | public Task SetAsync(TKey key, TValue value); | |
| 23 | | |
| 24 | public void Delete(TKey key); | |
| 25 | public Task DeleteAsync(TKey key); | |
| 26 | } |